-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (38 loc) · 1.19 KB
/
build.yaml
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
35
36
37
38
39
40
name: Build docker image and push to Artifact Registry
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v1
with:
token_format: access_token
workload_identity_provider: "projects/${{ secrets.GOOGLE_PROJECT_ID }}/locations/global/workloadIdentityPools/${{ secrets.GOOGLE_WID_POOL_ID }}/providers/${{ secrets.GOOGLE_WID_PROVIDER_ID }}"
service_account: ${{ secrets.GOOGLE_SA_EMAIL }}
- name: Login to GCR
uses: docker/login-action@v3
with:
registry: gcr.io
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Create Tag
id: create-tag
run: echo 'tag=${github.sha:0:7}' >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
user/app:${{ steps.create-tag.outputs.tag }}
user/app:latest