Skip to content

Test deployment for QA site #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ on:
push:
branches:
- master
- qa
- renovate/*
pull_request:
branches:
- master
- qa

jobs:
api-ci:
Expand Down
33 changes: 23 additions & 10 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- "master"
- "qa"

jobs:
build:
Expand Down Expand Up @@ -34,21 +35,21 @@ jobs:
uses: docker/build-push-action@v5
with:
context: ${{ matrix.component }}
push: ${{ github.event_name != 'pull_request' }}
push: ${{ github.event_name != 'pull_request' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/qa' ) }}
platforms: linux/amd64
file: ${{ matrix.component }}/Dockerfile
tags: |
ghcr.io/csesoc/website-${{ matrix.component }}:${{ github.sha }}
ghcr.io/csesoc/website-${{ matrix.component }}:latest
labels: ${{ steps.meta.outputs.labels }}
deploy-prod:
name: Deploy Production (CD)
deploy:
name: Deploy (CD)
runs-on: ubuntu-latest
needs: [build]
concurrency: prod
environment:
name: prod
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
if: ${{ github.event_name != 'pull_request' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/qa' ) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -58,17 +59,29 @@ jobs:
ref: develop
- name: Install yq - portable yaml processor
uses: mikefarah/[email protected]
- name: "Determine deployment type"
id: get_manifest
env:
BRANCH: ${{ github.ref }}
run: |
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
echo "TYPE=prod" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == "refs/heads/qa" ]]; then
echo "TYPE=qa" >> $GITHUB_OUTPUT
else
exit 1
fi
- name: Update deployment
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
git config user.name "CSESoc CD"
git config user.email "[email protected]"
git checkout -b update/website-prod/${{ github.sha }}
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/website-backend:${{ github.sha }}"' apps/projects/website/prod/deploy-backend.yml
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/website-frontend:${{ github.sha }}"' apps/projects/website/prod/deploy-frontend.yml
git checkout -b update/website-${{ steps.get_manifest.outputs.TYPE }}/${{ github.sha }}
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
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
git add .
git commit -m "feat(website/prod): update image"
git push -u origin update/website-prod/${{ github.sha }}
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
git commit -m "feat(website/${{ steps.get_manifest.outputs.TYPE }}): update image"
git push -u origin update/website-${{ steps.get_manifest.outputs.TYPE }}/${{ github.sha }}
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
gh pr merge $(cat URL) --squash -d
Loading