Skip to content

Commit 2919a07

Browse files
authored
chore(actions): use deployment dispatch action (#1114)
* chore(actions): use deployment dispatch action * fix(actions): keep deploy runner on ubuntu-latest
1 parent 177ed08 commit 2919a07

1 file changed

Lines changed: 10 additions & 24 deletions

File tree

.github/workflows/docker.yml

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
with:
3131
registry: ghcr.io
3232
username: ${{ github.actor }}
33-
password: ${{ secrets.GH_TOKEN }}
33+
password: ${{ github.token }}
3434
- name: Build and push Docker image
3535
uses: docker/build-push-action@v6
3636
with:
@@ -76,7 +76,7 @@ jobs:
7676
with:
7777
registry: ghcr.io
7878
username: ${{ github.actor }}
79-
password: ${{ secrets.GH_TOKEN }}
79+
password: ${{ github.token }}
8080
- name: Build and push Docker image
8181
uses: docker/build-push-action@v6
8282
with:
@@ -99,26 +99,12 @@ jobs:
9999
environment: production
100100

101101
steps:
102-
- name: Checkout repository
103-
uses: actions/checkout@v4
102+
- name: Dispatch deployment
103+
uses: devsoc-unsw/deployment-dispatch-action@a115e2ad9226805cd2588dc6fa5b7775991b141a
104104
with:
105-
repository: devsoc-unsw/deployment
106-
token: ${{ secrets.GH_TOKEN }}
107-
ref: dev
108-
- name: Install yq - portable yaml processor
109-
uses: mikefarah/yq@v4.44.2
110-
- name: Update deployment
111-
env:
112-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
113-
run: |
114-
git config user.name "CSESoc CD"
115-
git config user.email "technical@csesoc.org.au"
116-
git checkout -b update/${{ env.IMAGE_NAME }}/${{ github.sha }}
117-
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/devsoc-unsw/${{ env.IMAGE_NAME }}-client:${{ github.sha }}"' projects/notangles/${{ env.ENVIRONMENT }}/deploy-frontend.yml
118-
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/devsoc-unsw/${{ env.IMAGE_NAME }}-backend:${{ github.sha }}"' projects/notangles/${{ env.ENVIRONMENT }}/deploy-backend.yml
119-
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/devsoc-unsw/${{ env.IMAGE_NAME }}-auto-timetabler-server:${{ github.sha }}"' projects/notangles/${{ env.ENVIRONMENT }}/deploy-auto-timetabler.yml
120-
git add .
121-
git commit -m "feat(${{ env.IMAGE_NAME }}): update images"
122-
git push -u origin update/${{ env.IMAGE_NAME }}/${{ github.sha }}
123-
gh pr create -B dev --title "feat(${{ env.IMAGE_NAME }}): update images" --body "Updates the images for the ${{ env.IMAGE_NAME }} deployment to commit devsoc-unsw/${{ env.IMAGE_NAME }}@${{ github.sha }}." > URL
124-
gh pr merge $(cat URL) --squash -d
105+
deployment-dispatcher-app-id: ${{ vars.DEPLOYMENT_DISPATCHER_APP_ID }}
106+
deployment-dispatcher-app-private-key: ${{ secrets.DEPLOYMENT_DISPATCHER_APP_PRIVATE_KEY }}
107+
updates: |
108+
ghcr.io/devsoc-unsw/notangles-client=${{ github.sha }}
109+
ghcr.io/devsoc-unsw/notangles-backend=${{ github.sha }}
110+
ghcr.io/devsoc-unsw/notangles-auto-timetabler-server=${{ github.sha }}

0 commit comments

Comments
 (0)