push docker image #1
Workflow file for this run
This file contains 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: push docker image | |
on: | |
release: | |
types: [published] | |
env: | |
REGISTRY: ${{ secrets.ARTIFACT_REGISTRY_REGION }}-docker.pkg.dev | |
IMAGE_NAME: ${{ secrets.ARTIFACT_REGISTRY_REGION }}-docker.pkg.dev/${{ secrets.PROJECT_NAME }}/${{ secrets.REPOSITORY_NAME }}/${{ secrets.IMAGE_NAME }} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: "read" | |
id-token: "write" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | |
- name: Authenticate to GCP | |
uses: google-github-actions/auth@8254fb75a33b976a221574d287e93919e6a36f70 # v2.1.6 | |
with: | |
token_format: access_token | |
workload_identity_provider: projects/${{ secrets.PROJECT_NUMBER }}/locations/global/workloadIdentityPools/${{ secrets.IDENTITY_POOL_ID }}/providers/${{ secrets.IDENTITY_PROVIDER_ID }} | |
service_account: ${{ secrets.SERVICE_ACCOUNT }} | |
- name: Login into GCR | |
run: gcloud auth configure-docker ${{ env.REGISTRY }} | |
- name: Extract metadata | |
id: meta | |
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 | |
with: | |
images: ${{ env.IMAGE_NAME }} | |
tags: | | |
type=semver,pattern={{version}} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 | |
id: push | |
with: | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |