fix(gha): add main deploy and fix pr undeploy #7
Workflow file for this run
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: Push | |
on: | |
push: | |
branches: | |
- '*' | |
defaults: | |
run: | |
shell: bash -exuo pipefail {0} | |
jobs: | |
backend-format: | |
name: Backend Code Format | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: backend/go.mod | |
cache-dependency-path: backend/go.sum | |
- run: go fmt ./... | |
working-directory: backend | |
backend-unit-tests: | |
name: Backend Unit Tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: backend/go.mod | |
cache-dependency-path: backend/go.sum | |
- run: go test ./... | |
env: | |
CGO_ENABLED: "0" | |
GO111MODULE: "on" | |
GOOS: linux | |
GOARCH: amd64 | |
working-directory: backend | |
docker: | |
name: Build ${{ matrix.image }} image | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
image: [ backend, frontend, neo4j, migrations ] | |
fail-fast: false | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- if: matrix.image == 'frontend' | |
run: |- | |
cat > frontend/apply-patches.sh <<PATCHES_EOF | |
${{ secrets.FRONTEND_PATCHES }} | |
PATCHES_EOF | |
- uses: docker/setup-buildx-action@v2 | |
with: | |
install: true | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/build-push-action@v4 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
cache-from: type=gha,scope=${{ github.ref_name }}-${{ matrix.image }} | |
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-${{ matrix.image }} | |
context: ${{ matrix.image }} | |
push: true | |
tags: ghcr.io/${{ github.repository }}/${{ matrix.image }}:${{ github.sha }} |