56 lines
1.8 KiB
YAML
56 lines
1.8 KiB
YAML
name: CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
main
|
|
pull_request:
|
|
|
|
env:
|
|
CI: 1
|
|
|
|
jobs:
|
|
preflight:
|
|
runs-on: ubuntu-latest
|
|
name: Preflight checks
|
|
outputs:
|
|
be_changed: ${{ steps.be-changes.outputs.be_changed }}
|
|
fe_changed: ${{ steps.fe-changes.outputs.fe_changed }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Change check (frontend)
|
|
id: fe-changes
|
|
run: |
|
|
if [ "${{ github.ref }}" == "refs/heads/main" ] | [ -n "$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./.github)" ]
|
|
then
|
|
echo "fe_changed=true" >> "$GITHUB_OUTPUT"
|
|
exit 0
|
|
fi
|
|
git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./frontend
|
|
if [ -n "$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./frontend)" ]
|
|
then
|
|
echo "fe_changed=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
- name: Change check (backend)
|
|
id: be-changes
|
|
run: |
|
|
if [ "${{ github.ref }}" == "refs/heads/main" ] | [ -n "$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./.github)" ]
|
|
then
|
|
echo "be_changed=true" >> "$GITHUB_OUTPUT"
|
|
exit 0
|
|
fi
|
|
git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./backend
|
|
if [ -n "$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./backend)" ]
|
|
then
|
|
echo "be_changed=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
backend:
|
|
uses: ./.github/workflows/backend-pipeline.yml
|
|
needs: preflight
|
|
if: needs.preflight.outputs.be_changed == 'true'
|
|
frontend:
|
|
uses: ./.github/workflows/frontend-pipeline.yml
|
|
needs: preflight
|
|
if: needs.preflight.outputs.fe_changed == 'true'
|