-
Notifications
You must be signed in to change notification settings - Fork 15
90 lines (83 loc) · 4.92 KB
/
push-docker-images-release.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: push-docker-images-release
on:
release:
types: [published]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
DOCKER_BUILDKIT: 1
jobs:
push-containers:
permissions:
id-token: "write"
contents: "read"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "GIT_REVISION=$(git describe --always --dirty=-modified)" >> $GITHUB_ENV
# See https://github.com/google-github-actions/auth#authenticating-to-container-registry-and-artifact-registry
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver: docker-container
use: true
- name: Get the version
id: get_version
run: echo VERSION=${GITHUB_REF/refs\/tags\//} | tee -a $GITHUB_OUTPUT | tee -a $GITHUB_ENV
- name: Build
uses: docker/[email protected]
with:
files: docker-bake.hcl
workdir: .
targets: release
load: true
# Note that we can't push all tags simultaneously, since we use two
# different sets of credentials on us-west2-docker.pkg.dev. Instead, we
# save all images locally first, and then push to one repository at a
# time.
- id: "gcp-auth-private"
name: "Authenticate to GCP (private repositories)"
uses: "google-github-actions/auth@v1"
with:
workload_identity_provider: ${{ vars.GCP_ARTIFACT_PUBLISHER_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GCP_ARTIFACT_PUBLISHER_DEPLOY_SERVICE_ACCOUNT }}
token_format: "access_token"
access_token_lifetime: "3600s"
access_token_scopes: "https://www.googleapis.com/auth/cloud-platform"
- uses: "docker/login-action@v3"
with:
registry: "us-west2-docker.pkg.dev"
username: "oauth2accesstoken"
password: ${{ steps.gcp-auth-private.outputs.access_token }}
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregator:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregation_job_creator:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_aggregation_job_driver:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_collection_job_driver:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_cli:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_db_migrator:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_client:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_aggregator:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/janus-artifacts/janus/janus_interop_collector:${{ steps.get_version.outputs.VERSION }}
- id: "gcp-auth-public"
name: "Authenticate to GCP (public repositories)"
uses: "google-github-actions/auth@v1"
with:
workload_identity_provider: ${{ vars.GCP_PUBLIC_ARTIFACT_PUBLISHER_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.GCP_PUBLIC_ARTIFACT_PUBLISHER_DEPLOY_SERVICE_ACCOUNT }}
token_format: "access_token"
access_token_lifetime: "3600s"
access_token_scopes: "https://www.googleapis.com/auth/cloud-platform"
- uses: "docker/login-action@v3"
with:
registry: "us-west2-docker.pkg.dev"
username: "oauth2accesstoken"
password: ${{ steps.gcp-auth-public.outputs.access_token }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregator:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregation_job_creator:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_aggregation_job_driver:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_collection_job_driver:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_cli:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_db_migrator:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_client:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_aggregator:${{ steps.get_version.outputs.VERSION }}
- run: docker push us-west2-docker.pkg.dev/divviup-artifacts-public/janus/janus_interop_collector:${{ steps.get_version.outputs.VERSION }}