-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (47 loc) · 1.53 KB
/
build-and-push.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Build and push SDK Test Runner
on:
workflow_call:
inputs:
version:
description: 'Version string for SDK Test Runner release'
type: string
required: true
docker_context:
type: string
description: 'Directory where dockerfile exists'
required: true
image_name:
type: string
description: 'Docker image name'
required: true
env:
VERSION: 1.1.0
PROJECT_ID: ${{ vars.SDK_TESTING_PROJECT_ID }}
REGION: ${{ vars.SDK_TESTING_REGION }}
GAR_LOCATION: ${{ vars.SDK_TESTING_REGION }}-docker.pkg.dev/${{ vars.SDK_TESTING_PROJECT_ID }}/sdk-testing
jobs:
build-and-upload:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
# Set up gCloud
- id: "auth"
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.SERVICE_ACCOUNT_KEY }}"
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v1"
- name: "Use gcloud CLI"
run: "gcloud info"
# Allow docker access to the GAR
- name: "Docker auth"
run: |-
gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
# Build and push
- name: Build and export
uses: docker/build-push-action@v6
with:
push: true
context: ${{ inputs.docker_context }}
tags: ${{ env.GAR_LOCATION }}/${{ inputs.image_name }}:latest,${{ env.GAR_LOCATION }}/${{ inputs.image_name }}:${{ env.VERSION }}