fix: CI Docker tags must be lowercase, upgrade docker actions #4
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_PREFIX: ghcr.io/rwx-g/stackoverkill.io | |
| jobs: | |
| validate: | |
| name: Lint, Typecheck & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build shared package | |
| run: pnpm --filter @stackoverkill/shared build | |
| - name: Lint | |
| run: pnpm lint | |
| - name: Typecheck frontend | |
| run: pnpm --filter @stackoverkill/frontend exec tsc --noEmit | |
| - name: Typecheck backend | |
| run: pnpm --filter @stackoverkill/backend exec tsc --noEmit | |
| - name: Test | |
| run: pnpm test | |
| build-docker: | |
| name: Build Docker Images | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| if: github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build & push frontend image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: docker/frontend.Dockerfile | |
| push: true | |
| tags: | | |
| ${{ env.IMAGE_PREFIX }}/frontend:latest | |
| ${{ env.IMAGE_PREFIX }}/frontend:${{ github.sha }} | |
| - name: Build & push backend image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: docker/backend.Dockerfile | |
| push: true | |
| tags: | | |
| ${{ env.IMAGE_PREFIX }}/backend:latest | |
| ${{ env.IMAGE_PREFIX }}/backend:${{ github.sha }} |