Skip to content

Remove production target from Docker build command (#366) #48

Remove production target from Docker build command (#366)

Remove production target from Docker build command (#366) #48

Workflow file for this run

name: Deploy
on:
push:
branches: [production]
workflow_dispatch:
branches: [production]
concurrency: production
jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
build:
name: Build
permissions:
contents: read
id-token: write
packages: write
needs: ci
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: google-github-actions/auth@v2
id: gcloud-auth
with:
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
token_format: access_token
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
- name: Authenticate to Google Container Registry
uses: docker/login-action@v3
with:
registry: gcr.io
username: oauth2accesstoken
password: ${{ steps.gcloud-auth.outputs.access_token }}
- name: Authenticate to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate short SHA
id: vars
run: echo "::set-output name=short_sha::$(git rev-parse --short HEAD)"
- name: Build and push container images
uses: docker/build-push-action@v5
with:
cache-from: type=gha
cache-to: type=gha,mode=max
provenance: false
push: true
tags: |
gcr.io/${{ env.GCP_PROJECT }}/${{ github.repository }}:${{ steps.vars.outputs.short_sha }}
gcr.io/${{ env.GCP_PROJECT }}/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.vars.outputs.short_sha }}
ghcr.io/${{ github.repository }}:latest
deploy:
name: Deploy
permissions:
contents: read
id-token: write
needs: build
runs-on: ubuntu-latest
environment:
name: production
url: https://indieweb-endpoints.cc
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/auth@v2
with:
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
- uses: google-github-actions/deploy-cloudrun@v2
with:
image: gcr.io/${{ env.GCP_PROJECT }}/${{ github.repository }}
service: indieweb-endpoints-cc-web