Skip to content

chore: Set up docker buildx, configure-docker registry #7

chore: Set up docker buildx, configure-docker registry

chore: Set up docker buildx, configure-docker registry #7

Workflow file for this run

name: Google Artifact Registry
on:
push:
branches:
- main
- dev
tags:
- '*'
jobs:
docker-release:
name: Tagged Docker release to Google Artifact Registry
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- id: checkout
name: Checkout
uses: actions/checkout@v2
- id: auth
name: Authenticate with Google Cloud
uses: google-github-actions/auth@v2
with:
token_format: access_token
credentials_json: ${{ secrets.GCP_CREDENTIALS_JSON }}
access_token_lifetime: 300s
- name: Configure container registry
run: gcloud auth configure-docker us-east1-docker.pkg.dev
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Artifact Registry
uses: docker/login-action@v3
with:
registry: us-east1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Get tag
id: get-tag
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}
- name: Set Docker Tag
id: tag
run: |
if [[ "${GITHUB_REF}" == refs/heads/main ]]; then
tag="latest"
elif [[ "${GITHUB_REF}" == refs/heads/dev ]]; then
tag="nightly"
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
tag=${GITHUB_REF#refs/tags/}
else
tag=${GITHUB_REF#refs/heads/}
fi
echo "::set-output name=tag::${tag}"
echo "Docker tag: ${tag}"
- id: docker-push-tagged
name: Tag Docker image and push to Google Artifact Registry
uses: docker/build-push-action@v6
with:
push: true
tags: |
wevm
us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.get-tag.outputs.short_ref }}
us-east1-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_ARTIFACT_REPO }}/wevm:${{ steps.tag.outputs.tag }}