Skip to content

Commit

Permalink
Create gar-docker.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
AH-dark authored Apr 1, 2023
1 parent 6f5cf8c commit 8cdea70
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/gar-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Docker Release
on:
push:
tags: ['v*.*.*']

jobs:
gar-push:
name: Docker release to Google Artifact Registry
runs-on: ubuntu-latest

permissions:
contents: 'read'
id-token: 'write'

steps:
- id: checkout
name: Checkout
uses: actions/checkout@v3

- id: auth
name: Authenticate with Google Cloud
uses: google-github-actions/auth@v1
with:
token_format: access_token
workload_identity_provider: ${{ secrets.GCP_PROVIDER_ID }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}@${{ secrets.GCP_PROJECT_ID }}.iam.gserviceaccount.com
access_token_lifetime: 300s

- name: Login to Artifact Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.GCP_REGISTRY_REGION }}-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/*/}

- id: docker-push-tagged
name: Tag Docker image and push to Google Artifact Registry
uses: docker/build-push-action@v4
with:
push: true
tags: |
${{ secrets.GCP_REGISTRY_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_REGISTRY_ID }}/ahdark-me-redirector:${{ steps.get-tag.outputs.short_ref }}
${{ secrets.GCP_REGISTRY_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GCP_REGISTRY_ID }}/ahdark-me-redirector:latest

0 comments on commit 8cdea70

Please sign in to comment.