From 48c703d8a4f01d7ee2eb49af33bfa5eee41f2b98 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Tue, 2 Jul 2024 14:43:26 -0600 Subject: [PATCH] chore: build to github registry Signed-off-by: Gustavo --- .github/workflows/docker.yml | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e53e7f1..b203fe7 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,30 +1,26 @@ name: docker on: push: + branches: + - main tags: - '*' +env: + REGISTRY: ghcr.io/${{ github.repository_owner }} + jobs: build: runs-on: ubuntu-latest permissions: - contents: 'read' - id-token: 'write' + packages: write steps: - - id: auth - name: Authenticate with Google Cloud - uses: google-github-actions/auth@v0 - with: - token_format: access_token - workload_identity_provider: projects/661473808279/locations/global/workloadIdentityPools/github-actions/providers/gh-provider - service_account: artifact-uploader@graphplots.iam.gserviceaccount.com - access_token_lifetime: 600s - - name: Login to Artifact Registry - uses: docker/login-action@v1 + - name: Log in to the Container registry + uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 with: - registry: us-central1-docker.pkg.dev - username: oauth2accesstoken - password: ${{ steps.auth.outputs.access_token }} + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Get tag id: get-tag run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/} @@ -35,5 +31,5 @@ jobs: TARGET=${{ matrix.contract }} push: true tags: | - us-central1-docker.pkg.dev/graphplots/elric-rs/app:latest - us-central1-docker.pkg.dev/graphplots/elric-rs/app:${{ steps.get-tag.outputs.short_ref }} + ${{ env.REGISTRY }}/elric-rs/app:latest + ${{ env.REGISTRY }}/elric-rs/app:${{ steps.get-tag.outputs.short_ref }}