name: Build and publish container on: push: branches: - main tags: - 'v*' pull_request: branches: - main workflow_dispatch: concurrency: group: container-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: contents: read packages: write jobs: quality: name: Test, lint, and build runs-on: ubuntu-latest steps: - name: Check out repository uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: node-version: 24 cache: npm - name: Install dependencies run: npm ci - name: Run tests run: npm test - name: Run ESLint run: npm run lint - name: Build application run: npm run build container: name: Build and publish image needs: quality runs-on: ubuntu-latest steps: - name: Check out repository uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GHCR if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Generate image metadata id: meta uses: docker/metadata-action@v5 with: images: ghcr.io/${{ github.repository }} tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=branch type=ref,event=tag type=sha,prefix=sha- - name: Build and publish image uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max