Skip to content

Commit 911b8f7

Browse files
authored
Test deployment for QA site (#57)
* Add updated csesoc website deployment CI/CD * Deployment update for qa branch * Adjustment to deployment layout and appending qa deployment
1 parent a686bb6 commit 911b8f7

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ on:
44
push:
55
branches:
66
- master
7+
- qa
78
- renovate/*
89
pull_request:
910
branches:
1011
- master
12+
- qa
1113

1214
jobs:
1315
api-ci:

.github/workflows/docker.yml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- "master"
6+
- "qa"
67

78
jobs:
89
build:
@@ -34,21 +35,21 @@ jobs:
3435
uses: docker/build-push-action@v5
3536
with:
3637
context: ${{ matrix.component }}
37-
push: ${{ github.event_name != 'pull_request' }}
38+
push: ${{ github.event_name != 'pull_request' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/qa' ) }}
3839
platforms: linux/amd64
3940
file: ${{ matrix.component }}/Dockerfile
4041
tags: |
4142
ghcr.io/csesoc/website-${{ matrix.component }}:${{ github.sha }}
4243
ghcr.io/csesoc/website-${{ matrix.component }}:latest
4344
labels: ${{ steps.meta.outputs.labels }}
44-
deploy-prod:
45-
name: Deploy Production (CD)
45+
deploy:
46+
name: Deploy (CD)
4647
runs-on: ubuntu-latest
4748
needs: [build]
4849
concurrency: prod
4950
environment:
5051
name: prod
51-
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
52+
if: ${{ github.event_name != 'pull_request' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/qa' ) }}
5253
steps:
5354
- name: Checkout repository
5455
uses: actions/checkout@v4
@@ -58,17 +59,29 @@ jobs:
5859
ref: develop
5960
- name: Install yq - portable yaml processor
6061
uses: mikefarah/yq@v4.27.2
62+
- name: "Determine deployment type"
63+
id: get_manifest
64+
env:
65+
BRANCH: ${{ github.ref }}
66+
run: |
67+
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
68+
echo "TYPE=prod" >> $GITHUB_OUTPUT
69+
elif [[ "${{ github.ref }}" == "refs/heads/qa" ]]; then
70+
echo "TYPE=qa" >> $GITHUB_OUTPUT
71+
else
72+
exit 1
73+
fi
6174
- name: Update deployment
6275
env:
6376
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
6477
run: |
6578
git config user.name "CSESoc CD"
6679
git config user.email "technical@csesoc.org.au"
67-
git checkout -b update/website-prod/${{ github.sha }}
68-
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/website-backend:${{ github.sha }}"' apps/projects/website/prod/deploy-backend.yml
69-
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/website-frontend:${{ github.sha }}"' apps/projects/website/prod/deploy-frontend.yml
80+
git checkout -b update/website-${{ steps.get_manifest.outputs.TYPE }}/${{ github.sha }}
81+
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/website-backend:${{ github.sha }}"' apps/projects/website/${{ steps.get_manifest.outputs.TYPE }}/deploy-backend.yml
82+
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/website-frontend:${{ github.sha }}"' apps/projects/website/${{ steps.get_manifest.outputs.TYPE }}/deploy-frontend.yml
7083
git add .
71-
git commit -m "feat(website/prod): update image"
72-
git push -u origin update/website-prod/${{ github.sha }}
73-
gh pr create -B develop --title "feat(website/prod): update image" --body "Updates the image for the website-prod deployment to commit csesoc/csesoc-website@${{ github.sha }}." > URL
84+
git commit -m "feat(website/${{ steps.get_manifest.outputs.TYPE }}): update image"
85+
git push -u origin update/website-${{ steps.get_manifest.outputs.TYPE }}/${{ github.sha }}
86+
gh pr create -B develop --title "feat(website/${{ steps.get_manifest.outputs.TYPE }}): update image" --body "Updates the image for the website-prod deployment to commit csesoc/csesoc-website@${{ github.sha }}." > URL
7487
gh pr merge $(cat URL) --squash -d

0 commit comments

Comments
 (0)