fix(deps): update weekly minor & patch updates #5566
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker | |
on: | |
push: | |
jobs: | |
build: | |
name: "Build (${{ matrix.component }})" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
component: [backend, frontend] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GH_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/jobs-board-${{ matrix.component }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ matrix.component }} | |
push: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main') }} | |
platforms: linux/amd64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
file: ${{ matrix.component }}/Dockerfile | |
tags: | | |
ghcr.io/csesoc/jobs-board-${{ matrix.component }}:${{ github.sha }} | |
labels: ${{ steps.meta.outputs.labels }} | |
deploy-staging: | |
name: Deploy Staging (CD) | |
runs-on: ubuntu-latest | |
needs: [build] | |
concurrency: staging | |
environment: | |
name: Staging | |
url: https://jobsboard.staging.csesoc.unsw.edu.au | |
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
repository: csesoc/deployment | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Install yq | |
uses: mikefarah/[email protected] | |
- 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/jobsboard/${{ github.sha }} | |
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/jobs-board-frontend:${{ github.sha }}"' apps/projects/jobsboard/staging/deploy-frontend.yml | |
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/jobs-board-backend:${{ github.sha }}"' apps/projects/jobsboard/staging/deploy-backend.yml | |
git add . | |
git commit -m "feat(jobsboard/staging): update images" | |
git push -u origin update/jobsboard/${{ github.sha }} | |
gh pr create --title "feat(jobsboard/staging): update images" --body "Updates the images for the jobsboard deployment to commit csesoc/jobsboard@${{ github.sha }}." > URL | |
gh pr merge $(cat URL) --squash -d | |
deploy-prod: | |
name: Deploy Production (CD) | |
runs-on: ubuntu-latest | |
needs: [build] | |
concurrency: prod | |
environment: | |
name: Production | |
url: https://jobsboard.csesoc.unsw.edu.au | |
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
repository: csesoc/deployment | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Install yq | |
uses: mikefarah/[email protected] | |
- 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/jobsboard/${{ github.sha }} | |
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/jobs-board-frontend:${{ github.sha }}"' apps/projects/jobsboard/prod/deploy-frontend.yml | |
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/jobs-board-backend:${{ github.sha }}"' apps/projects/jobsboard/prod/deploy-backend.yml | |
git add . | |
git commit -m "feat(jobsboard/prod): update images" | |
git push -u origin update/jobsboard/${{ github.sha }} | |
gh pr create --title "feat(jobsboard/prod): update images" --body "Updates the images for the jobs-board deployment to commit csesoc/jobs-board@${{ github.sha }}." > URL | |
gh pr merge $(cat URL) --squash -d |