1+ name : Build Efiling API Image and Push to Openshift 4 Registry
2+
3+ on :
4+ schedule :
5+ - cron : " 0 0 * */3 *"
6+ push :
7+ branches : [master]
8+ paths :
9+ - " src/backend/**"
10+ - " .github/workflows/dev-efiling-api-build.yaml"
11+ workflow_dispatch :
12+
13+ jobs :
14+ build :
15+ runs-on : ubuntu-latest
16+
17+ steps :
18+ - uses : actions/checkout@v2
19+
20+ - name : Login to Artifactory
21+ uses : docker/login-action@v1
22+ with :
23+ registry : artifacts.developer.gov.bc.ca
24+ username : ${{ secrets.EFILING_ARTIFACTORY_USERNAME }}
25+ password : ${{ secrets.EFILING_ARTIFACTORY_PASSWORD }}
26+
27+ - name : Build Image
28+ env :
29+ MVN_PROFILE : efiling-api,splunk
30+ run : |
31+ docker compose build efiling-api
32+ docker tag jag-file-submission-efiling-api artifacts.developer.gov.bc.ca/efc7-efiling-api/efiling-api:dev
33+
34+ - name : Docker Push to Artifactory
35+ run : |
36+ docker push artifacts.developer.gov.bc.ca/efc7-efiling-api/efiling-api:dev
37+
38+ # Get SHORT_SHA for the version
39+ - name : Get short SHA
40+ id : short_sha
41+ run : |
42+ echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)"
43+ echo "Short SHA: $SHORT_SHA"
44+
45+ - name : Checkout ArgoCD Repo
46+ id : gitops
47+ uses : actions/checkout@v4
48+ with :
49+ repository : bcgov-c/tenant-gitops-fc726a
50+ ref : develop
51+ token : ${{ secrets.ARGO_PAT }} # `ARGO_PAT` is a secret that contains your PAT
52+ path : gitops
53+
54+ - name : Update Helm Values and Commit
55+ id : helm
56+ if : steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful
57+ run : |
58+ # Clone the GitOps deployment configuration repository
59+ # Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test and
60+ cd gitops/charts
61+
62+ # Update the Helm values file with the new image tag and version
63+ DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time
64+
65+ sed -i "s/apitag: .*/apitag: dev # Image Updated on $DATETIME/" ../deploy/dev_values.yaml
66+ sed -i "s/apiVersion: .*/apiVersion: ${{ steps.short_sha.outputs.SHORT_SHA }} # Version Updated on $DATETIME/" ../deploy/dev_values.yaml
67+
68+ # Commit and push the changes
69+ git config --global user.email "[email protected] " 70+ git config --global user.name "GitHub Actions"
71+
72+ git add .
73+
74+ git add ../deploy/dev_values.yaml
75+
76+ # Repackage Helm Chart
77+
78+ cd efiling-gitops
79+
80+ helm dependency build
81+
82+ cd charts
83+
84+ git add .
85+
86+ git commit -m "Update Dev API image tag"
87+ git push origin develop # Update the branch name as needed
0 commit comments