-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat: 新增檢查後端和前端變更的工作流程,優化部署條件"
This reverts commit 4337c48.
- Loading branch information
Showing
1 changed file
with
3 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,36 +6,8 @@ on: | |
- main | ||
|
||
jobs: | ||
# Check for changes in backend and frontend | ||
check-diff: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
backend_changed: ${{ steps.check_backend.outputs.changed }} | ||
frontend_changed: ${{ steps.check_frontend.outputs.changed }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Check if backend has changes | ||
id: check_backend | ||
run: | | ||
if git diff --quiet HEAD^ HEAD -- ./app; then | ||
echo "changed=false" >> $GITHUB_OUTPUT | ||
else | ||
echo "changed=true" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Check if frontend has changes | ||
id: check_frontend | ||
run: | | ||
if git diff --quiet HEAD^ HEAD -- ./frontend; then | ||
echo "changed=false" >> $GITHUB_OUTPUT | ||
else | ||
echo "changed=true" >> $GITHUB_OUTPUT | ||
fi | ||
# Backend build and push job | ||
backend: | ||
if: needs.check-diff.outputs.backend_changed == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -61,9 +33,8 @@ jobs: | |
cache-from: type=registry,ref=hanshino/redive_backend:buildcache | ||
cache-to: type=registry,ref=hanshino/redive_backend:buildcache,mode=max | ||
|
||
# Frontend build and push job | ||
# Frontend build and push job, executed in parallel with backend | ||
frontend: | ||
if: needs.check-diff.outputs.frontend_changed == 'true' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -91,11 +62,10 @@ jobs: | |
build-args: | | ||
REACT_APP_GOOGLE_ANALYTICS_ID=${{ secrets.GOOGLE_ANALYTICS_ID }} | ||
# Deployment job | ||
# Deployment job, dependent on both backend and frontend build completion | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: [backend, frontend] # Ensure that both backend and frontend jobs are finished before deploying | ||
if: needs.backend.result == 'success' || needs.frontend.result == 'success' | ||
steps: | ||
- name: Deploy Redive linebot | ||
uses: appleboy/[email protected] | ||
|
@@ -113,4 +83,4 @@ jobs: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | ||
uses: Ilshidur/action-discord@master | ||
with: | ||
args: "{{ github.repository }} deployment complete." | ||
args: "{{ EVENT_PAYLOAD.repository.full_name }} 已完成部署" |