feat: update dry runs to match prod #2
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 + Push Sequencer Image to Github and Google Registries + Trigger Cloud Run Deployment | |
| on: | |
| push: | |
| # TODO | |
| # branches: | |
| # - main | |
| env: | |
| GITHUB_REGISTRY: ghcr.io | |
| GOOGLE_REGISTRY: europe-west6-docker.pkg.dev | |
| PROJECT_ID: metabased-testnet | |
| REPO_NAME: metabased-rollup | |
| SERVICE_NAME: metabased-sequencer | |
| WORKLOAD_IDENTITY_PROVIDER: projects/112197761096/locations/global/workloadIdentityPools/cloud-run-github-pool/providers/id-001 | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: 'read' | |
| id-token: 'write' | |
| packages: 'write' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.GITHUB_REGISTRY }} | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure Google Cloud credentials | |
| uses: google-github-actions/auth@v2 | |
| with: | |
| workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }} | |
| service_account: 'cloud-run-service-account@metabased-testnet.iam.gserviceaccount.com' | |
| - name: Set up Cloud SDK | |
| uses: google-github-actions/setup-gcloud@v2 | |
| - name: Configure docker auth for GAR | |
| run: | | |
| gcloud auth configure-docker ${{ env.GOOGLE_REGISTRY }} --quiet | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Extract metadata for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/${{ env.SERVICE_NAME }} | |
| ${{ env.GOOGLE_REGISTRY }}/${{ env.PROJECT_ID }}/cloud-run-source-deploy/${{ env.REPO_NAME }}/${{ env.SERVICE_NAME }} | |
| tags: | | |
| type=sha,format=long | |
| type=semver,pattern={{version}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| push: true | |
| target: metabased-sequencer | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Trigger Cloud Run here to prevent race condition | |
| - name: Trigger Cloud Run Deployment | |
| # && github.ref == 'refs/heads/main' | |
| if: success() | |
| run: | | |
| gcloud builds triggers run deploy-metabased-sequencer \ | |
| --region=global \ | |
| --project=metabased-testnet |