1.7.0 #39
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Prod Environment | |
on: | |
release: | |
types: [published] | |
jobs: | |
deploy-emerald: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout ArgoCD Repo | |
id: gitops | |
uses: actions/checkout@v4 | |
with: | |
repository: bcgov-c/tenant-gitops-b0471a | |
ref: prod | |
token: ${{ secrets.GITOPS }} | |
- name: Update Helm Values and Commit | |
id: helm | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITOPS }} | |
run: | | |
# Ensure GitHub CLI is authenticated | |
gh auth status || gh auth login --with-token <<< "${{ secrets.GITOPS }}" | |
# Get current date and time | |
datetime=$(date +'%Y-%m-%d %H:%M:%S') | |
vtag=${{ github.ref_name }} | |
# Update image tag in Helm values | |
sed -i "s/tag: .*/tag: ${vtag//v} # Image Updated on $datetime/" deploy/prod_values.yaml | |
# Configure git | |
git config --global user.email "[email protected]" | |
git config --global user.name "Young-Jin Chung" | |
# Add and commit changes | |
git add deploy/prod_values.yaml | |
cd charts/gitops/charts | |
helm package ../../frontend/ | |
helm package ../../backend/ | |
helm package ../../hangfire/ | |
git add . | |
git commit -m "Update image tag to ${vtag//v} on $datetime" | |
git push origin prod | |
# Create PR to main | |
gh pr create \ | |
--base main \ | |
--head prod \ | |
--title "Sync prod to main for ${vtag}" \ | |
--body "This PR syncs changes from the `prod` branch to the `main` branch for ${vtag}" |