1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35name: Build GCP Artifact Registry Image
on:
workflow_dispatch:
env:
PROJECT_ID: prefect-community
GAR_LOCATION: us-east1
SERVICE: sls
REGION: us-east1
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Google Auth
id: auth
uses: google-github-actions/auth@v0
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: Docker Auth
id: docker-auth
uses: docker/login-action@v1
with:
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
registry: '${{ env.GAR_LOCATION }}-docker.pkg.dev'
- name: Build and Push Container
run: |-
docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}" -f Dockerfile.gcp .
docker push "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}"