Revert "Added ci pipeline for staging branch" #3310
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: [ "dev", "renovate/*" ] | |
jobs: | |
build: | |
name: "Build (${{ matrix.component }})" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
component: [frontend, backend] | |
include: | |
- component: frontend | |
dockerfile: production.dockerfile | |
args: | | |
"API_URL=https://circlesapi.devsoc.app" | |
- component: backend | |
dockerfile: production.dockerfile | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: arm64 | |
- 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.GH_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ matrix.component }} | |
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' }} | |
platforms: linux/amd64 | |
file: ${{ matrix.component }}/${{ matrix.dockerfile }} | |
build-args: ${{ matrix.args }} | |
tags: | | |
ghcr.io/csesoc/circles-${{ matrix.component }}:${{ github.sha }} | |
ghcr.io/csesoc/circles-${{ matrix.component }}:latest | |
labels: ${{ steps.meta.outputs.labels }} | |
deploy: | |
name: Deploy (CD) | |
runs-on: ubuntu-latest | |
needs: [build] | |
concurrency: production | |
environment: production | |
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 }} | |
ref: migration | |
- name: Install yq - portable yaml processor | |
uses: mikefarah/yq@v4.35.2 | |
- name: Update deployment | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: | | |
git config user.name "CSESoc CD" | |
git config user.email "technical@csesoc.org.au" | |
git checkout -b update/circles/${{ github.sha }} | |
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/circles-frontend:${{ github.sha }}"' projects/circles/deploy-frontend.yml | |
yq -i '.items[0].spec.template.spec.containers[0].image = "ghcr.io/csesoc/circles-backend:${{ github.sha }}"' projects/circles/deploy-backend.yml | |
git add . | |
git commit -m "feat(circles): update images" | |
git push -u origin update/circles/${{ github.sha }} | |
gh pr create -B migration --title "feat(circles): update image" --body "Updates the image for the circles deployment to commit csesoc/circles@${{ github.sha }}." > URL | |
gh pr merge $(cat URL) --squash -d |