@@ -16,13 +16,20 @@ jobs:
16
16
env :
17
17
TEST_TAG : ${{ github.repository }}:test
18
18
TEST_CONTAINER_NAME : jbi-healthcheck
19
+ GAR_LOCATION : us
20
+ GAR_REPOSITORY : jbi-prod
21
+ GCP_PROJECT_ID : moz-fx-jbi-prod
22
+ IMAGE : jbi
19
23
steps :
20
24
- name : Check out the repo
21
25
uses : actions/checkout@v4
22
26
with :
23
27
fetch-depth : 0 # Fetch everything (tags)
28
+ fetch-tags : true
29
+
24
30
- name : Set tag version
25
31
run : echo "JBI_TAG=$(git describe --tags --abbrev=4)" >> $GITHUB_ENV
32
+
26
33
- name : Build `version.json` file
27
34
run : |
28
35
printf '{\n "commit": "%s",\n "version": "%s",\n "source": "%s",\n "build": "%s"\n}\n' \
@@ -35,27 +42,43 @@ jobs:
35
42
id : meta
36
43
uses : docker/metadata-action@v5
37
44
with :
38
- images : ${{ github.repository }}
45
+ images :
46
+ ${{ github.repository }}
47
+ ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.IMAGE }}
39
48
# https://github.com/marketplace/actions/docker-metadata-action#tags-input
40
49
tags : |
41
50
type=semver,pattern={{raw}}
42
51
type=raw,value=latest,enable={{is_default_branch}}
43
52
type=sha,prefix=,enable={{is_default_branch}}
44
53
54
+ - id : gcp_auth
55
+ name : Log into GCP
56
+ uses : google-github-actions/auth@v2
57
+ if : github.event_name != 'pull_request'
58
+ with :
59
+ token_format : access_token
60
+ service_account : artifact-writer@${{ env.GCP_PROJECT_ID }}.iam.gserviceaccount.com
61
+ workload_identity_provider : ${{ vars.GCPV2_GITHUB_WORKLOAD_IDENTITY_PROVIDER }}
62
+
45
63
- name : Login to Docker Hub
46
64
if : github.event_name != 'pull_request'
47
65
uses : docker/login-action@v3
48
66
with :
49
67
username : ${{ secrets.DOCKERHUB_USERNAME }}
50
68
password : ${{ secrets.DOCKERHUB_TOKEN }}
51
69
70
+ - name : Set up Docker Buildx
71
+ uses : docker/setup-buildx-action@v3
72
+
52
73
- name : Build and export to Docker
53
74
uses : docker/build-push-action@v6
54
75
with :
55
76
context : .
56
77
load : true
57
78
push : false
58
79
tags : ${{ env.TEST_TAG }}
80
+ cache-from : type=gha
81
+ cache-to : type=gha,mode=max
59
82
60
83
- name : Spin up container
61
84
run : |
80
103
context : .
81
104
push : ${{ github.event_name != 'pull_request' }}
82
105
tags : ${{ steps.meta.outputs.tags }}
106
+ cache-from : type=gha
107
+ cache-to : type=gha,mode=max
0 commit comments