-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update CD workflow to support manual deployments * Optimize the CI pipeline to only test what has changed
- Loading branch information
1 parent
49e9d1b
commit ab83d0a
Showing
2 changed files
with
57 additions
and
8 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,42 @@ on: | |
- main | ||
|
||
jobs: | ||
setup: | ||
name: Deploy Setup | ||
runs-on: ubuntu-latest | ||
outputs: | ||
frontend-changed: ${{ steps.changes.outputs.frontend-changed }} | ||
data-changed: ${{ steps.changes.outputs.data-changed }} | ||
backend-changed: ${{ steps.changes.outputs.backend-changed }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Detect Changes | ||
id: changes | ||
run: | | ||
FRONTEND_DIFF=$(git diff --name-only origin/main -- frontend/* | wc -l | xargs) | ||
DATA_DIFF=$(git diff --name-only origin/main -- data/* | wc -l | xargs) | ||
BACKEND_DIFF=$(git diff --name-only origin/main -- backend/* | wc -l | xargs) | ||
if [[ "$FRONTEND_DIFF" == "1" ]]; then | ||
echo "frontend-changed=true" >> $GITHUB_OUTPUT | ||
fi | ||
if [[ "$DATA_DIFF" == "1" ]]; then | ||
echo "data-changed=true" >> $GITHUB_OUTPUT | ||
fi | ||
if [[ "$BACKEND_DIFF" == "1" ]]; then | ||
echo "backend-changed=true" >> $GITHUB_OUTPUT | ||
fi | ||
build-frontend: | ||
name: Build Frontend | ||
if: ${{ needs.setup.outputs.frontend-changed == 'true' }} | ||
runs-on: ubuntu-latest | ||
needs: [setup] | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
@@ -26,7 +59,9 @@ jobs: | |
build-data: | ||
name: Build Data | ||
if: ${{ needs.setup.outputs.data-changed == 'true' }} | ||
runs-on: ubuntu-latest | ||
needs: [setup] | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
@@ -40,7 +75,9 @@ jobs: | |
test-backend: | ||
name: Deploy & Test Backend | ||
if: ${{ needs.setup.outputs.backend-changed == 'true' }} | ||
runs-on: ubuntu-latest | ||
needs: [setup] | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|