-
Notifications
You must be signed in to change notification settings - Fork 272
81 lines (70 loc) · 2.44 KB
/
build-and-upload-job.yml
File metadata and controls
81 lines (70 loc) · 2.44 KB
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
name: Build And Upload Job
on:
workflow_dispatch:
inputs:
commit_sha:
description: "Specific commit SHA to checkout"
required: true
type: string
tracking_id:
description: "Unique tracking ID used for identifying the workflow run"
required: false
type: string
environment:
description: "Target environment for deployment, e.g. staging"
required: true
type: string
job_names:
description: "Name of the jobs to build-and-upload, e.g. api, template-manager, separated by ;"
required: true
type: string
permissions:
contents: read
concurrency:
group: deploy-${{ inputs.environment }}
cancel-in-progress: false
jobs:
deploy:
name: Build and upload job to the ${{ inputs.environment }} environment
runs-on: ci-builder
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
ref: ${{ inputs.commit_sha }}
- name: Setup environment
uses: ./.github/actions/deploy-setup
with:
environment: ${{ inputs.environment }}
infisical_client_id: ${{ secrets.INFISICAL_CLIENT_ID }}
infisical_client_secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
install_gcloud: "true"
- name: Set up Docker
env:
GCP_REGION: ${{ env.GCP_REGION }}
run: |
gcloud auth configure-docker "${GCP_REGION}-docker.pkg.dev" --quiet
export ACCESS_TOKEN=$(gcloud auth print-access-token)
export DOCKER_AUTH_BASE64=$(echo -n "{\"username\":\"oauth2accesstoken\",\"password\":\"$ACCESS_TOKEN\"}" | base64 -w 0)
echo "::add-mask::$DOCKER_AUTH_BASE64"
echo "DOCKER_AUTH_BASE64=${DOCKER_AUTH_BASE64}" >> $GITHUB_ENV
shell: bash
- name: Build and upload jobs
env:
AUTO_CONFIRM_DEPLOY: true
run: |
# Parse semicolon-separated job names
IFS=';' read -ra JOBS <<< "${{ inputs.job_names }}"
# Build and upload each job
for job_name in "${JOBS[@]}"; do
# Trim whitespace
job_name=$(echo "$job_name" | xargs)
if [ -n "$job_name" ]; then
echo "::group::Building and uploading job: $job_name"
make build-and-upload/$job_name
echo "::endgroup::"
fi
done