diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfc4c9b..6ae12ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,32 +69,46 @@ jobs: run: pnpm build docker: - name: Build Docker Images + name: Build & Push Docker Images runs-on: ubuntu-latest needs: [build] if: github.ref == 'refs/heads/main' + permissions: + contents: read + packages: write steps: - uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Build API image + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push API image uses: docker/build-push-action@v6 with: context: . file: apps/api/Dockerfile - push: false - tags: groombook/api:${{ github.sha }} + push: true + tags: | + ghcr.io/groombook/api:${{ github.sha }} + ghcr.io/groombook/api:latest cache-from: type=gha cache-to: type=gha,mode=max - - name: Build Web image + - name: Build and push Web image uses: docker/build-push-action@v6 with: context: . file: apps/web/Dockerfile - push: false - tags: groombook/web:${{ github.sha }} + push: true + tags: | + ghcr.io/groombook/web:${{ github.sha }} + ghcr.io/groombook/web:latest cache-from: type=gha cache-to: type=gha,mode=max