-
-
Notifications
You must be signed in to change notification settings - Fork 17
294 lines (276 loc) · 10.2 KB
/
nightly.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# https://github.com/containerd/containerd/blob/main/.github/workflows/release.yml
# https://devtron.ai/blog/create-ci-cd-pipelines-with-github-actions-for-kubernetes-the-definitive-guide
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
# https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/manually-running-a-workflow
name: "Nightly"
description: "Nightly snuggsi ツ Build"
#--------------------------------------------------------------------------
permissions: # added using https://github.com/step-security/secure-workflows
issues: none
checks: none
actions: write
contents: write
id-token: write # Provenance
packages: none
deployments: none
pull-requests: none
repository-projects: none
#--------------------------------------------------------------------------
on:
schedule: # https://en.wikipedia.org/wiki/Cron
- cron: "0 0 * * *" # Midnight UTC
push:
branches:
- main
workflow_dispatch: {}
#--------------------------------------------------------------------------
env:
# Prevent script injection
EMAIL: ${{ secrets.EMAIL }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
#--------------------------------------------------------------------------
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
jobs:
#--------------------------------------------------------------------------
scan:
name: 🔎 Scan
runs-on: ubuntu-20.04
steps: # --------------------------------------------------------------
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
#--------------------------------------------------------------------------
build:
name: 🏗️ Build
timeout-minutes: 5
runs-on: ubuntu-20.04
steps: # --------------------------------------------------------------
- name: Update
run: |
sudo apt-get update
sudo apt-get install -y zopfli
- name: Checkout
uses: actions/checkout@v4 # https://github.com/actions/checkout
with:
fetch-depth: 1
fetch-tags: false
ref: ${{ github.ref }}
- name: Setup # https://github.com/marketplace/actions/setup-node-js-environment
uses: actions/setup-node@v4 # https://github.com/actions/setup-node
with:
cache: npm
node-version: 18.x
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#working-with-lockfiles
cache-dependency-path: 'npm-shrinkwrap.json'
- name: Install
run: |
npm ci --no-audit --no-progress --ignore-scripts --prefer-offline
npm version
- name: Compile
run: bin/compile
#--------------------------------------------------------------------------
test:
name: 📊 Test
runs-on: ubuntu-20.04
env: # Prevent script injection
SNUGGSI: "."
PUPPETEER_SKIP_DOWNLOAD: true
# CHROMEDRIVER_BINARY: ../../../node_modules/chromedriver/lib/chromedriver/chromedriver
steps: # --------------------------------------------------------------
- name: Checkout
id: checkout
uses: actions/checkout@v4 # https://github.com/actions/checkout
with:
fetch-depth: 1
fetch-tags: false
ref: ${{ github.ref }}
- name: Node Setup # https://github.com/marketplace/actions/setup-node-js-environment
id: setup
uses: actions/setup-node@v4 # https://github.com/actions/setup-node
with:
cache: npm
node-version: 18.x
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#working-with-lockfiles
cache-dependency-path: 'npm-shrinkwrap.json'
- name: Node Install
id: install
run: |
npm ci --no-audit --no-progress --ignore-scripts --prefer-offline
npm version
- name: Chrome Setup
id: chrome
# https://github.com/browser-actions/setup-chrome
uses: browser-actions/[email protected]
with:
chrome-version: stable
# https://www.npmjs.com/package/chromedriver
# https://sites.google.com/chromium.org/driver
install-chromedriver: true
install-dependencies: false
- name: Test
id: test
run: |
npm run
node --version
${{ steps.chrome.outputs.chrome-path }} --version
# TODO: Determine if necessary ------------------------
echo
echo setting nullglob
echo From $(shopt -p nullglob)
shopt -s nullglob
echo To $(shopt -p nullglob)
echo
# -----------------------------------------------------
node --test index.test.es ./**/*.test.{es,js}
- name: Cover
id: cover
run: bin/cover || true # TODO: Get to 100% Coverage
#--------------------------------------------------------------------------
publish: # https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-nodejs-packages
name: 🗞️ Publish
needs: [scan,build,test]
runs-on: ubuntu-20.04
steps: # --------------------------------------------------------------
- uses: actions/checkout@v4 # https://github.com/actions/checkout
with:
fetch-depth: 1
fetch-tags: false
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
# - run: |
# print "${GPG_SIGNING_KEY}" | base64 --decode > private.key
# ls -al *.key
# gpg --import private.key
# gpg --list-keys
- run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$EMAIL"
- run: bin/version
#--------------------------------------------------------------------------
archive: # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/storing-and-sharing-data-from-a-workflow
# needs: [publish]
name: 🧊 Archive
needs: [publish]
timeout-minutes: 5
runs-on: ubuntu-20.04
outputs:
aid: ${{ steps.artifact-upload.outputs.artifact-id }}
steps: # --------------------------------------------------------------
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
fetch-tags: false
- name: Setup
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- name: Notate
run: |
npm pkg get version
git tag -l "v$( npm pkg get version | tr -d \" )" -n 200 >> CHANGELOG.md
#git tag -l ${RELEASEVER#refs/tags/} -n20000 | tail -n +3 | cut -c 5- >> CHANGELOG.md
- name: Upload
uses: actions/upload-artifact@v4 # https://github.com/actions/upload-artifact
id: artifact-upload
with:
retention-days: 30
compression-level: 9
if-no-files-found: warn
name: snuggsi-${{ github.run_id }}
path: |
dist
!dist/*.md
CHANGELOG.md
#--------------------------------------------------------------------------
release: # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/storing-and-sharing-data-from-a-workflow
name: 🎉 Release
needs: [publish]
timeout-minutes: 5
runs-on: ubuntu-20.04
# outputs:
# stringver: ${{ steps.contentrel.outputs.stringver }}
steps: # --------------------------------------------------------------
- name: Checkout code
uses: actions/checkout@v4 # https://github.com/actions/checkout
- name: Release
env:
AID: ${{ needs.archive.outputs.aid }}
TAG: ${{ env.TAG }}
run: echo "${TAG} Artifact ID from previous job is ${AID}"
#--------------------------------------------------------------------------
check:
needs: [publish]
timeout-minutes: 5
name: 🔒 Check
runs-on: ubuntu-20.04
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps: # --------------------------------------------------------------
- name: Checkout
id: checkout
uses: actions/checkout@v4 # https://github.com/actions/checkout
with:
fetch-depth: 1
fetch-tags: false
ref: ${{ github.ref }}
- name: Setup # https://github.com/marketplace/actions/setup-node-js-environment
id: setup
uses: actions/setup-node@v4 # https://github.com/actions/setup-node
with:
cache: npm
node-version: 18.x
# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#working-with-lockfiles
cache-dependency-path: 'npm-shrinkwrap.json'
- name: Install
id: install
run: |
npm ci --no-audit --no-progress --ignore-scripts --prefer-offline
npm version
# - name: Set RELEASE_VER
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
# run: |
# releasever=${{ github.ref }}
# releasever="${releasever#refs/tags/}"
- name: Check signature
env:
RELEASEREF=${{ github.ref }}
RELEASEVER="${releasever#refs/tags/}"
run: |
git tag -v ${RELEASEVER}
echo RELEASEREF $RELEASEREF
echo RELEASEVER $RELEASEVER
echo "RELEASE_VER=${RELEASEVER}" >> $GITHUB_ENV
echo $GITHUB_ENV
# TAGCHECK=$(git tag -v ${releasever} 2>&1 >/dev/null)
# echo "${TAGCHECK}" | grep -q "error" && {
# echo "::error::tag ${releasever} is not a signed tag. Failing release process."
# exit 1
# } || {
# echo "Tag ${releasever} is signed."
# exit 0
# }