@@ -11,18 +11,24 @@ concurrency:
1111 group : ${{ github.workflow }} @ ${{ github.ref }}
1212 cancel-in-progress : true
1313
14+ env :
15+ # Diff base for pnpm --filter change detection
16+ CHANGED_SINCE : ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && github.event.before || 'origin/main' }}
17+
1418jobs :
1519 build :
1620 runs-on : ubuntu-latest
1721 timeout-minutes : 10
1822 steps :
1923 - uses : actions/checkout@v6
24+ with :
25+ fetch-depth : 0
2026 - uses : ./.github/setup
2127 with :
2228 only-changed : true
2329 FONTAWESOME_NPM_AUTH_TOKEN : ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
24- - run : pnpm --filter "...[origin/main ]..." --if-present codegen
25- - run : pnpm --filter "...[origin/main ]..." --if-present build
30+ - run : pnpm --filter "...[${{ env.CHANGED_SINCE }} ]..." --if-present codegen
31+ - run : pnpm --filter "...[${{ env.CHANGED_SINCE }} ]..." --if-present build
2632 - name : Archive production artifacts
2733 uses : actions/upload-artifact@v7
2834 with :
@@ -46,34 +52,40 @@ jobs:
4652 timeout-minutes : 10
4753 steps :
4854 - uses : actions/checkout@v6
55+ with :
56+ fetch-depth : 0
4957 - uses : ./.github/setup
5058 with :
5159 only-changed : true
5260 FONTAWESOME_NPM_AUTH_TOKEN : ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
53- - run : pnpm --filter "...[origin/main ]..." --if-present codegen
54- - run : pnpm --filter "...[origin/main ]..." --if-present generate
55- - run : pnpm --filter "...[origin/main ]" --if-present lint:eslint
61+ - run : pnpm --filter "...[${{ env.CHANGED_SINCE }} ]..." --if-present codegen
62+ - run : pnpm --filter "...[${{ env.CHANGED_SINCE }} ]..." --if-present generate
63+ - run : pnpm --filter "...[${{ env.CHANGED_SINCE }} ]" --if-present lint:eslint
5664 - run : pnpm lint
5765
5866 test :
5967 runs-on : ubuntu-latest
6068 timeout-minutes : 10
6169 steps :
6270 - uses : actions/checkout@v6
71+ with :
72+ fetch-depth : 0
6373 - uses : ./.github/setup
6474 with :
6575 only-changed : true
6676 FONTAWESOME_NPM_AUTH_TOKEN : ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
6777 - run : pnpm exec playwright install chromium --only-shell
68- - run : pnpm --filter "...[origin/main ]..." --if-present codegen
69- - run : pnpm --filter "...[origin/main ]..." --if-present generate
70- - run : pnpm --filter "...[origin/main ]" --if-present test
78+ - run : pnpm --filter "...[${{ env.CHANGED_SINCE }} ]..." --if-present codegen
79+ - run : pnpm --filter "...[${{ env.CHANGED_SINCE }} ]..." --if-present generate
80+ - run : pnpm --filter "...[${{ env.CHANGED_SINCE }} ]" --if-present test
7181
7282 e2e :
7383 timeout-minutes : 10
7484 runs-on : ubuntu-latest
7585 steps :
7686 - uses : actions/checkout@v6
87+ with :
88+ fetch-depth : 0
7789 - uses : ./.github/setup
7890 with :
7991 only-changed : true
@@ -87,13 +99,13 @@ jobs:
8799 run : |
88100 sudo echo "127.0.0.1 navigate.lucuma.xyz" | sudo tee -a /etc/hosts
89101 - run : pnpm exec playwright install firefox --only-shell
90- - run : pnpm --filter "...@gemini-hlsw/ navigate-e2e[origin/main ]..." --if-present build
91- - run : pnpm --filter "...@gemini-hlsw/ navigate-e2e[origin/main ]..." --if-present e2e:docker-up
102+ - run : pnpm --filter "...navigate-e2e[${{ env.CHANGED_SINCE }} ]..." --if-present build
103+ - run : pnpm --filter "...navigate-e2e[${{ env.CHANGED_SINCE }} ]..." --if-present e2e:docker-up
92104 env :
93105 LUCUMA_REFRESH_TOKEN : ${{ secrets.LUCUMA_DEV_API_KEY }}
94106
95107 - name : Run Playwright tests
96- run : pnpm --filter "...@gemini-hlsw/ navigate-e2e[origin/main ]..." --if-present test:e2e
108+ run : pnpm --filter "...navigate-e2e[${{ env.CHANGED_SINCE }} ]..." --if-present test:e2e
97109 env :
98110 LUCUMA_REFRESH_TOKEN : ${{ secrets.LUCUMA_DEV_API_KEY }}
99111 DATABASE_URL : ' postgresql://jimmy:banana@127.0.0.1:5432/configs'
@@ -265,3 +277,34 @@ jobs:
265277 env :
266278 HEROKU_API_KEY : ${{ secrets.HEROKU_API_KEY }}
267279 run : ./deploy/deploy-heroku.sh
280+
281+ deploy-resource :
282+ runs-on : ubuntu-latest
283+ if : (github.ref == 'refs/heads/main' && github.repository_owner == 'gemini-hlsw')
284+ timeout-minutes : 10
285+ environment :
286+ name : resource-ui-dev
287+ url : ' https://resource-dev.lucuma.xyz'
288+ steps :
289+ - uses : actions/checkout@v6
290+ with :
291+ fetch-depth : 0
292+ - uses : ./.github/setup
293+ with :
294+ only-changed : true
295+ FONTAWESOME_NPM_AUTH_TOKEN : ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
296+ - run : pnpm --filter "...resource-ui[${{ env.CHANGED_SINCE }}]..." --if-present build
297+
298+ # Set env.DEPLOY_RESOURCE if there are changes
299+ - run : pnpm --filter "...resource-ui[${{ env.CHANGED_SINCE }}]..." --if-present ci:set-deploy-flag
300+
301+ - name : Deploy staging app to Firebase
302+ if : env.DEPLOY_RESOURCE == 'true'
303+ uses : FirebaseExtended/action-hosting-deploy@v0
304+ with :
305+ repoToken : ${{ secrets.GITHUB_TOKEN }}
306+ firebaseServiceAccount : ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
307+ projectId : ${{ vars.FIREBASE_PROJECT_ID }}
308+ entryPoint : ./packages/resource-ui
309+ target : dev
310+ channelId : live
0 commit comments