feat: batch insert route (#10) #34
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: | |
branches: | |
- "master" | |
jobs: | |
build: | |
name: "Build" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }} | |
platforms: linux/amd64 | |
file: Dockerfile | |
tags: | | |
ghcr.io/devsoc-unsw/hasuragres:${{ github.sha }} | |
ghcr.io/devsoc-unsw/hasuragres:latest | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
deploy: | |
name: Deploy (CD) | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
repository: csesoc/deployment | |
ref: migration | |
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/hasuragres/${{ github.sha }} | |
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/devsoc-unsw/hasuragres:${{ github.sha }}"' projects/hasuragres/hasuragres.yml | |
git add . | |
git commit -m "feat(hasuragres): update image" | |
git push -u origin update/hasuragres/${{ github.sha }} | |
gh pr create -B migration --title "feat(hasuragres): update image" --body "Updates the image for the hasuragres deployment to commit devsoc-unsw/hasuragres@${{ github.sha }}." > URL | |
gh pr merge $(cat URL) --squash -d |