-
-
Notifications
You must be signed in to change notification settings - Fork 31
167 lines (145 loc) · 4.29 KB
/
build.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Daffodil Build
env:
NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
on:
push:
branches:
- develop
tags: ["v*"]
pull_request:
branches:
- develop
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
node: [18.19.x]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: nrwl/nx-set-shas@v3
name: Derive appropriate SHAs for base and head for `nx affected` commands
with:
main-branch-name: 'develop'
- uses: actions/cache@v3
name: Cache `.nx_cache`
id: build_cache
with:
path: .nx_cache
key: build-${{ matrix.node }}-${{ github.sha }}
restore-keys:
build-${{ matrix.node }}
- uses: graycoreio/github-actions/clear-old-nx-cache@main
with:
size-in-mb: 500
- uses: graycoreio/github-actions/setup-node@main
with:
node-version: ${{ matrix.node }}
use-stamp-cache: true
- run: npx lerna run build --concurrency=1
- run: cd dist/apps/daffio && zip -r ../daffio.zip .
- uses: actions/upload-artifact@v3
with:
name: daffio-${{ matrix.node }}
path: dist/apps/daffio.zip
if-no-files-found: error
compute_packages:
name: Compute Packages to Test
outputs:
packages: ${{ steps.compute.outputs.packages }}
runs-on: ubuntu-latest
needs: [ ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: graycoreio/github-actions/setup-node@main
with:
node-version: '18.19.x'
use-stamp-cache: true
- uses: nrwl/nx-set-shas@v3
name: Derive appropriate SHAs for base and head for `nx affected` commands
with:
main-branch-name: 'develop'
- name: packages
id: compute
shell: bash
run: |
packages=$(npx lerna ls --since=$NX_BASE --all --json | jq '[.[] | .name]' -c)
echo "packages=$packages" >> ${GITHUB_OUTPUT}
test:
name: Test
runs-on: ubuntu-latest
if: ${{ needs.compute_packages.outputs.packages != '[]' && needs.compute_packages.outputs.packages != '' }}
strategy:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.compute_packages.outputs.packages) }}
node: [18.19.x]
needs:
- compute_packages
- build
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: nrwl/nx-set-shas@v3
name: Derive appropriate SHAs for base and head for `nx affected` commands
with:
main-branch-name: 'develop'
- uses: actions/cache@v3
name: Cache `.nx_cache`
id: build_cache
with:
fail-on-cache-miss: true
path: .nx_cache
key: build-${{ matrix.node }}-${{ github.sha }}
- uses: graycoreio/github-actions/setup-node@main
with:
node-version: ${{ matrix.node }}
use-stamp-cache: true
- run: npx lerna run test --scope="${{ matrix.package }}" --concurrency=1
name: Test ${{ matrix.package }}
deploy_daffio:
name: Deploy Daff.io
needs:
- build
uses: ./.github/workflows/deploy.yml
secrets:
VERCEL_NEXT_PROJECT_ID: ${{ secrets.VERCEL_DAFFIO_NEXT_PROJECT_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_DAFFIO_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG: ${{ secrets.VERCEL_ORG }}
with:
artifact: daffio-18.19.x
artifact-zip-name: daffio.zip
publish:
name: Publish
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs:
- build
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/cache@v3
name: Cache `.nx_cache`
id: build_cache
with:
fail-on-cache-miss: true
path: .nx_cache
key: build-18.19.x-${{ github.sha }}
- uses: graycoreio/github-actions/setup-node@main
with:
node-version: 18.19.x
use-stamp-cache: true
registry-url: 'https://registry.npmjs.org'
- run: npx lerna run build
- uses: graycoreio/github-actions/set-versions-from-root@main
- run: npx lerna run publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}