-
Notifications
You must be signed in to change notification settings - Fork 2.5k
61 lines (51 loc) · 2.66 KB
/
deploy-services.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Deploy services
on:
push:
branches:
- 'main'
concurrency:
group: deployments
cancel-in-progress: false
jobs:
get_affected_apps:
name: Get affected apps
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0 # NX needs the entire repo history to run affected commands
- name: Set NX commit SHAs for affected commands
uses: nrwl/nx-set-shas@v2 # derive appropriate SHAs for base and head for `nx affected` commands
# Only install nx affected command requirements, no need for a full dependency install
- name: Install requirements for nx
run: |
NX_REPO_VERSION=$(node -e "console.log(require('./package.json').devDependencies['@nrwl/workspace'])")
TS_REPO_VERSION=$(node -e "console.log(require('./package.json').devDependencies['typescript'])")
yarn add -D @nrwl/workspace@$NX_REPO_VERSION --prefer-offline
yarn add -D typescript@$TS_VERSION --prefer-offline
./node_modules/.bin/nx affected:apps --plain
- name: Set affected outputs
id: set_affected_outputs
shell: bash
run: ./tools/scripts/getAffectedApps.sh
- name: Verify outputs
run: |
echo "Will deploy client? ${{ steps.set_affected_outputs.outputs.client_affected == 'true' && 'yes' || 'no' }}"
echo "Will deploy server? ${{ steps.set_affected_outputs.outputs.server_affected == 'true' && 'yes' || 'no' }}"
echo "Will deploy workers? ${{ steps.set_affected_outputs.outputs.workers_affected == 'true' && 'yes' || 'no' }}"
outputs:
should_deploy_client: ${{ steps.set_affected_outputs.outputs.client_affected }}
should_deploy_server: ${{ steps.set_affected_outputs.outputs.server_affected }}
should_deploy_workers: ${{ steps.set_affected_outputs.outputs.workers_affected }}
deploy_production:
name: Deploy production services
needs: [get_affected_apps]
uses: ./.github/workflows/template.deploy-services.yml
with:
deploy_env: production
deploy_shared_stack: true
deploy_vercel_client: ${{ needs.get_affected_apps.outputs.should_deploy_client == 'true' }}
deploy_server_stack: ${{ needs.get_affected_apps.outputs.should_deploy_server == 'true' }}
deploy_workers_stack: ${{ needs.get_affected_apps.outputs.should_deploy_workers == 'true' }}
secrets: inherit