This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
refactor: add package y-idb
#64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
permissions: | |
packages: write | |
jobs: | |
build-server: | |
name: Build Server | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
- name: Use Node.js LTS | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'pnpm' | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build Packages | |
run: pnpm run build:packages | |
- name: Build Server | |
run: pnpm run build | |
working-directory: apps/server | |
- name: Upload server dist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: server-dist | |
path: ./apps/server/dist | |
if-no-files-found: error | |
build-docker: | |
runs-on: ubuntu-latest | |
name: Build Docker | |
if: github.ref == 'refs/heads/main' | |
needs: | |
- build-server | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download server dist | |
uses: actions/download-artifact@v3 | |
with: | |
name: server-dist | |
path: ./apps/server/dist | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
logout: false | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
id: pnpm-install | |
- name: Use Node.js LTS | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'pnpm' | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --prod | |
- name: Setup Git short hash | |
run: | | |
echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV" | |
- name: Build Dockerfile | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
pull: true | |
platforms: linux/amd64 | |
provenance: true | |
file: .github/deployment/server/Dockerfile | |
tags: ghcr.io/himself65/refine:${{ env.GIT_SHORT_HASH }},ghcr.io/himself65/refine:latest |