Change to make new PR #2
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: PR Closed | |
on: | |
pull_request: | |
types: [closed] | |
concurrency: | |
# PR open and close use the same group, allowing only one at a time | |
group: pr-${{ github.workflow }}-${{ github.event.number }} | |
cancel-in-progress: true | |
jobs: | |
# Clean up OpenShift when PR closed, no conditions | |
cleanup-openshift: | |
name: Cleanup OpenShift | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Setup gitops repo access | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Checkout CD repo | |
uses: actions/checkout@v4 | |
with: | |
repository: bcgov-c/tenant-gitops-a7469b | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
ref: main | |
- name: Calculate Deployment Number | |
id: get-deployment-number | |
shell: bash | |
run: | | |
PR_NUMBER=$(echo ${{ github.event.number }}) | |
PR_NUMBER_MOD_FIVE=$(($PR_NUMBER % 5)) | |
echo "DEPLOYMENT_NUMBER=$(($PR_NUMBER_MOD_FIVE + 1))" >> $GITHUB_OUTPUT | |
- name: Configure git | |
# From https://github.com/orgs/community/discussions/26560#discussioncomment-3531273 | |
run: | | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
- name: Update image tag And Enable it for deployment | |
run: | | |
DEPLOYMENT_NUMBER=${{ steps.get-deployment-number.outputs.DEPLOYMENT_NUMBER }} | |
cd charts/quickstart-openshift-emerald | |
yq eval '.global.enabled=false' -i values-"$DEPLOYMENT_NUMBER".yaml | |
- name: Commit and push update | |
shell: bash | |
run: | | |
git commit -am "removing the deployment and disable it for values-${{ steps.get-deployment-number.outputs.DEPLOYMENT_NUMBER }}.yaml" | |
git push origin main | |