Workflow file for this run
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: Build and push Docker image for prod | |
| on: | |
| release: | |
| types: [prereleased] | |
| jobs: | |
| build_and_push: | |
| name: Build and push prod image | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| attestations: write | |
| artifact-metadata: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 #v4.1.0 | |
| - name: Login to Google Cloud | |
| uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0 | |
| with: | |
| service_account: ${{ secrets.GCP_SA }} | |
| workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
| request_reason: "shield_image_push" | |
| create_credentials_file: true | |
| - name: Set up Google Cloud CLI | |
| uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3.0.1 | |
| - name: Configure Google Cloud Docker registry | |
| run: gcloud auth configure-docker ${{ secrets.GAR_LOCATION_URL }} | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Get Git commit timestamps | |
| id: time | |
| run: echo "epoch=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 | |
| id: build | |
| with: | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| sbom: true | |
| provenance: mode=max | |
| tags: | | |
| ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} | |
| ${{ secrets.GAR_IMAGE_URL }}:${{ github.event.release.tag_name }} | |
| file: ./Dockerfile | |
| env: | | |
| SOURCE_DATE_EPOCH: "${{ env.epoch }}" | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Generate artifact attestation | |
| uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0 | |
| with: | |
| subject-name: ghcr.io/${{ github.repository }} | |
| subject-digest: ${{ steps.build.outputs.digest }} | |
| push-to-registry: true |