This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
rotini/.github/workflows/ci.yml

57 lines
1.8 KiB
YAML
Raw Normal View History

2023-08-11 05:31:38 +00:00
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: |
2023-08-11 05:31:38 +00:00
if [ "${{ github.ref }}" == "refs/heads/main" ] | [ -n "$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./.github)" ]
2023-08-09 04:15:40 +00:00
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: |
2023-08-11 05:31:38 +00:00
if [ "${{ github.ref }}" == "refs/heads/main" ] | [ -n "$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} -- ./.github)" ]
2023-08-09 04:15:40 +00:00
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
2023-08-11 05:31:38 +00:00
backend:
uses: ./.github/workflows/backend-pipeline.yml
needs: preflight
if: needs.preflight.outputs.be_changed == 'true'
2023-08-11 05:31:38 +00:00
frontend:
uses: ./.github/workflows/frontend-pipeline.yml
needs: preflight
if: needs.preflight.outputs.fe_changed == 'true'