1+ name : Release Index
2+
3+ on :
4+ workflow_call :
5+ workflow_dispatch :
6+ push :
7+ branches :
8+ - main
9+
10+ jobs :
11+ check-changes :
12+ runs-on : ubuntu-latest
13+ if : github.event_name != 'workflow_dispatch'
14+ outputs :
15+ should_deploy : ${{ steps.set_output.outputs.should_deploy }}
16+ steps :
17+ - name : Checkout code
18+ uses : actions/checkout@v3
19+ with :
20+ fetch-depth : 0
21+ - name : Get changed files
22+ id : changes
23+ uses : tj-actions/changed-files@v41
24+ with :
25+ files_yaml : |
26+ app-index:
27+ - 'apps/index/**'
28+ - 'packages/**'
29+ - name : Log changed-files outputs
30+ shell : bash
31+ run : |
32+ echo "=== tj-actions/changed-files@v41 outputs ==="
33+ echo '${{ toJSON(steps.changes.outputs) }}'
34+ - name : Set deployment output
35+ id : set_output
36+ run : |
37+ if [ "${{ steps.changes.outputs.app-index_any_changed }}" = "true" ]; then
38+ echo "should_deploy=true" >> $GITHUB_OUTPUT
39+ else
40+ echo "should_deploy=false" >> $GITHUB_OUTPUT
41+ fi
42+
43+ deploy-index :
44+ runs-on : ubuntu-latest
45+ name : Deploy Index
46+ needs : [check-changes]
47+ if : always() && (github.event_name == 'workflow_dispatch' || needs.check-changes.outputs.should_deploy == 'true')
48+ steps :
49+ - name : Checkout code
50+ uses : actions/checkout@v3
51+ with :
52+ fetch-depth : 1
53+ - name : Log deployment reason
54+ run : |
55+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
56+ echo "✅ Manual trigger - proceeding with deployment"
57+ else
58+ echo "✅ Changes detected in relevant files - proceeding with deployment"
59+ fi
60+ - uses : ./.github/actions/setup
61+ - uses : ./.github/actions/vercel-pull
62+ with :
63+ environment : production
64+ prodFlag : --prod
65+ vercel_project_id : ${{ secrets.VERCEL_PROJECT_INDEX_ID }}
66+ vercel_org_id : ${{ secrets.VERCEL_ORG_ID }}
67+ vercel_token : ${{ secrets.VERCEL_TOKEN }}
68+ - uses : ./.github/actions/vercel-build
69+ with :
70+ environment : production
71+ prodFlag : --prod
72+ vercel_project_id : ${{ secrets.VERCEL_PROJECT_INDEX_ID }}
73+ vercel_org_id : ${{ secrets.VERCEL_ORG_ID }}
74+ vercel_token : ${{ secrets.VERCEL_TOKEN }}
75+ - uses : ./.github/actions/vercel-deploy
76+ with :
77+ environment : production
78+ prodFlag : --prod
79+ vercel_project_id : ${{ secrets.VERCEL_PROJECT_INDEX_ID }}
80+ vercel_org_id : ${{ secrets.VERCEL_ORG_ID }}
81+ vercel_token : ${{ secrets.VERCEL_TOKEN }}
0 commit comments