-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (49 loc) · 1.78 KB
/
publish-cloud-builder.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
# Automatically build Docker images using a cloud builder and publish them to a
# container registry using HCL Bake file.
name: Build Docker Images using Cloud Builder
on:
# workflow_dispatch:
# pull_request:
# branches: ['main']
push:
branches: ['main']
tags: ['*']
jobs:
# When pushing into main will build the regular multi-arch image
# For pull requests will use the default target to only
# generate local architecture version
bake-target:
name: Determine bake target
runs-on: ubuntu-22.04 # don't use the big runners for this small step
outputs:
target: ${{ steps.generate.outputs.bake_target }}
steps:
- name: Determine target
id: generate
run: |
# NOTE: Using direct target names instead of group names as its a single
# image build and want to use the target as part of the output image tag
if [[ '${{ github.event_name }}' == 'pull_request' ]]; then
TGT=askem-forecast-hub-base
else
TGT=askem-forecast-hub
fi
echo "$TGT"
echo "bake_target=${TGT,,}" >> ${GITHUB_OUTPUT}
- name: Show Generated Tag
run: echo ${{ steps.generate.outputs.bake_target }}
# Build and Publish all targets associated with specified group
bake:
needs:
- bake-target
uses: darpa-askem/.github/.github/workflows/bake-publish-cloud-builder.yaml@main
with:
file: 'docker-bake.hcl'
group: ${{ needs.bake-target.outputs.target }}
registry: 'ghcr.io'
organization: ${{ github.repository_owner }}
secrets:
username: ${{ secrets.DOCKER_CLOUD_BUILD_USERNAME }}
token: ${{ secrets.DOCKER_CLOUD_BUILD_TOKEN }}
endpoint: "${{ secrets.DOCKER_CLOUD_BUILD_ENDPOINT }}"