1
+ name : Deployment
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - development
7
+ - main
8
+
9
+ jobs :
10
+ deployment :
11
+ runs-on : ubuntu-latest
12
+ environment :
13
+ name : ${{ github.ref_name }}
14
+ concurrency : ${{ github.ref_name }}
15
+
16
+ permissions :
17
+ contents : ' read'
18
+ id-token : ' write'
19
+
20
+ env :
21
+ IMAGE : mirc-ctp
22
+
23
+ steps :
24
+ - name : Checkout repository
25
+ uses : actions/checkout@v4
26
+
27
+ - name : Authenticate with Google Cloud
28
+ uses : google-github-actions/auth@v2
29
+ with :
30
+ project_id : ${{ secrets.WORKLOAD_IDENTITY_PROJECT }}
31
+ workload_identity_provider : ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
32
+
33
+ - name : Set up Cloud SDK
34
+ uses : ' google-github-actions/setup-gcloud@v2'
35
+ with :
36
+ version : ' >= 363.0.0'
37
+
38
+ - name : Configure docker for Google artifact registry
39
+ id : docker
40
+ run : |
41
+ gcloud auth configure-docker ${{ vars.REGISTRY }}
42
+ branch=${GITHUB_REF##*/}
43
+ ts=$(date +%Y%m%d%H%M%S)
44
+ echo "BUILD_ID=${branch}-${ts}" >> $GITHUB_OUTPUT
45
+ echo "BRANCH_NAME=${branch}" >> $GITHUB_OUTPUT
46
+
47
+ - name : Setup buildx so we can use GHA caching
48
+ uses : docker/setup-buildx-action@v3
49
+
50
+ - name : Setup Java
51
+ uses : actions/setup-java@v4
52
+ with :
53
+ java-version : ' 8'
54
+ distribution : ' temurin'
55
+
56
+ - name : Run make
57
+ run : make install
58
+
59
+ - name : Build and push image
60
+ uses : docker/build-push-action@v6
61
+ with :
62
+ context : .
63
+ cache-from : type=gha
64
+ cache-to : type=gha,mode=max
65
+ push : true
66
+ tags : |
67
+ ${{ vars.REGISTRY }}/${{ secrets.REPOSITORY }}/${{ env.IMAGE }}:${{ steps.docker.outputs.BUILD_ID }}
68
+ ${{ vars.REGISTRY }}/${{ secrets.REPOSITORY }}/${{ env.IMAGE }}:${{ github.sha }}
69
+ ${{ vars.REGISTRY }}/${{ secrets.REPOSITORY }}/${{ env.IMAGE }}:${{ steps.docker.outputs.BRANCH_NAME }}
70
+ ${{ vars.REGISTRY }}/${{ secrets.REPOSITORY }}/${{ env.IMAGE }}:latest
0 commit comments