3737 with :
3838 registry : ghcr.io
3939 username : ${{ github.actor }}
40- password : ${{ secrets.GH_TOKEN }}
40+ password : ${{ github.token }}
4141 - name : Build and push Docker image
4242 uses : docker/build-push-action@v4
4343 with :
@@ -58,37 +58,13 @@ jobs:
5858 environment :
5959 name : production (projects-bot)
6060 steps :
61- - name : Checkout repository
62- uses : actions/checkout@v4
61+ - name : Dispatch deployment
62+ uses : devsoc-unsw/deployment-dispatch-action@main
6363 with :
64- repository : csesoc/deployment
65- token : ${{ secrets.GH_TOKEN }}
66- - name : Install yq - portable yaml processor
67- uses : mikefarah/yq@v4.44.2
68- - name : Determine file to update
69- id : get_manifest
70- env :
71- BRANCH_NAME : ${{ github.ref }}
72- run : |
73- if [ "$BRANCH_NAME" = "refs/heads/projects-bot" ]; then
74- echo "MANIFEST=apps/projects/bot/ptb/deploy.yml" >> $GITHUB_OUTPUT
75- echo "DEPLOYMENT=ptb" >> $GITHUB_OUTPUT
76- elif [ "$BRANCH_NAME" = "refs/heads/develop" ]; then
77- echo "MANIFEST=apps/projects/bot/qa/deploy.yml" >> $GITHUB_OUTPUT
78- echo "DEPLOYMENT=qa" >> $GITHUB_OUTPUT
79- else
80- exit 1
81- fi
82- - name : Update deployment
83- env :
84- GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
85- run : |
86- git config user.name "CSESoc CD"
87- git config user.email "technical@csesoc.org.au"
88- git checkout -b update/projects-bot/${{ github.sha }}
89- yq -i '.spec.template.spec.containers[0].image = "ghcr.io/csesoc/projects-discord-bot:${{ github.sha }}"' ${{ steps.get_manifest.outputs.MANIFEST }}
90- git add .
91- git commit -m "feat(projects-bot/${{ steps.get_manifest.outputs.DEPLOYMENT }}): update images"
92- git push -u origin update/projects-bot/${{ github.sha }}
93- gh pr create --title "feat(projects-bot/${{ steps.get_manifest.outputs.DEPLOYMENT }}): update images" --body "Updates the images for the projects-bot deployment to commit csesoc/discord-bot@${{ github.sha }}." > URL
94- gh pr merge $(cat URL) --squash -d
64+ deployment-dispatcher-app-id : ${{ vars.DEPLOYMENT_DISPATCHER_APP_ID }}
65+ deployment-dispatcher-app-private-key : ${{ secrets.DEPLOYMENT_DISPATCHER_APP_PRIVATE_KEY }}
66+ owner : csesoc
67+ repository : deployment
68+ ref : develop
69+ updates : |
70+ ghcr.io/csesoc/projects-discord-bot=${{ github.sha }}
0 commit comments