feat: publish metabased-sequencer to ghcr and google #5
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 Sequencer Docker Image to Github and Google Registries | |
| on: | |
| push: #TODO fix me to push on main | |
| env: | |
| 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: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Debug Info | |
| run: | | |
| echo "Repository: ${{ github.repository }}" | |
| echo "Repository Owner: ${{ github.repository_owner }}" | |
| echo "Actor: ${{ github.actor }}" | |
| echo "Ref: ${{ github.ref }}" | |
| - 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: Debug Google Auth | |
| run: | | |
| gcloud auth list | |
| gcloud config get-value project | |
| gcloud config get-value account | |
| - 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: Debug Docker Config | |
| run: | | |
| cat ~/.docker/config.json | |
| docker info | |
| - 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: | | |
| ghcr.io/${{ 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 |