66 - " dev"
77
88env :
9- BRANCH_NAME : ${{ github.base_ref || github.ref_name }}
9+ ENVIRONMENT : ${{ github.ref_name == 'master' && 'prod' || 'staging' }}
10+ IMAGE_NAME : ${{ github.ref_name == 'master' && 'freerooms' || 'freerooms-staging' }}
1011
1112jobs :
1213 build :
5152 platforms : linux/amd64
5253 file : ${{ matrix.context }}.dockerfile
5354 tags : |
54- ghcr.io/csesoc/freerooms -${{ matrix.name }}:${{ github.sha }}
55- ghcr.io/csesoc/freerooms -${{ matrix.name }}:latest
55+ ghcr.io/devsoc-unsw/${{ env.IMAGE_NAME }} -${{ matrix.name }}:${{ github.sha }}
56+ ghcr.io/devsoc-unsw/${{ env.IMAGE_NAME }} -${{ matrix.name }}:latest
5657 labels : ${{ steps.meta.outputs.labels }}
5758 deploy :
5859 name : Deploy (CD)
6465 - name : Checkout repository
6566 uses : actions/checkout@v4
6667 with :
67- repository : csesoc /deployment
68+ repository : devsoc-unsw /deployment
6869 token : ${{ secrets.GH_TOKEN }}
69- ref : migration
70+ ref : dev
7071 - name : Install yq - portable yaml processor
7172 uses : mikefarah/yq@v4.44.3
7273 - name : Update deployment
@@ -76,26 +77,12 @@ jobs:
7677 git config user.name "CSESoc CD"
7778 git config user.email "technical@csesoc.org.au"
7879
79- case $BRANCH_NAME in
80- dev)
81- build_type="staging"
82- ;;
83-
84- master)
85- build_type="prod"
86- ;;
87- *)
88- echo "Invalid branch '$branch'"
89- exit 1
90- ;;
91- esac
92-
93- git checkout -b update/freerooms-$build_type/${{ github.sha }}
94- yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/freerooms-backend:${{ github.sha }}"' projects/freerooms/$build_type/deploy-backend.yml
95- yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/freerooms-frontend:${{ github.sha }}"' projects/freerooms/$build_type/deploy-frontend.yml
80+ git checkout -b update/${{ env.IMAGE_NAME }}/${{ github.sha }}
81+ yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/devsoc-unsw/${{ env.IMAGE_NAME }}-backend:${{ github.sha }}"' projects/freerooms/${{ env.ENVIRONMENT }}/deploy-backend.yml
82+ yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/devsoc-unsw/${{ env.IMAGE_NAME }}-frontend:${{ github.sha }}"' projects/freerooms/${{ env.ENVIRONMENT }}/deploy-frontend.yml
9683
9784 git add .
98- git commit -m "feat(freerooms-$build_type ): update images"
99- git push -u origin update/freerooms-$build_type /${{ github.sha }}
100- gh pr create -B migration --title "feat(freerooms-$build_type ): update image" --body "Updates the image for the freerooms deployment to commit csesoc/freerooms @${{ github.sha }}." > URL
85+ git commit -m "feat(${{ env.IMAGE_NAME }} ): update images"
86+ git push -u origin update/${{ env.IMAGE_NAME }} /${{ github.sha }}
87+ gh pr create -B dev --title "feat(${{ env.IMAGE_NAME }} ): update image" --body "Updates the image for the ${{ env.IMAGE_NAME }} deployment to commit devsoc-unsw/${{ env.IMAGE_NAME }} @${{ github.sha }}." > URL
10188 gh pr merge $(cat URL) --squash -d
0 commit comments