-
Notifications
You must be signed in to change notification settings - Fork 62
86 lines (78 loc) · 3 KB
/
main.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
name: build
# If this CI run was triggered via `repository_dispatch` from
# https://github.com/kaitai-io/kaitai_struct, change the run name so that it's
# not just "rebuild". Otherwise, return an empty string so that GitHub keeps the
# default name.
run-name: |
${{ (github.event_name == 'repository_dispatch' &&
github.event.action == 'rebuild' &&
github.event.client_payload.ksc_version) &&
format('Build with kaitai-struct-compiler {0}', github.event.client_payload.ksc_version) ||
'' }}
on:
push:
branches:
- master
- stable
# Allow this workflow to be run on the `master` branch when a webhook event
# called `repository_dispatch` is triggered. This is used from the CI workflow
# in https://github.com/kaitai-io/kaitai_struct to rebuild the devel Web IDE
# after a new version of KSC is published to npm.
repository_dispatch:
types:
- rebuild
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Use appropriate versions of KSC and JS runtime
env:
DIST_TAG: ${{ github.ref == 'refs/heads/master' && 'next' || 'latest' }}
# `--package-lock-only` means that it only updates `package-lock.json`
# (and `package.json`) without touching `node_modules/` at all.
run: |
npm install --package-lock-only kaitai-struct-compiler@"$DIST_TAG" kaitai-struct@"$DIST_TAG"
# NOTE: it's important that `npm ci` is run *after* the adjustment of
# KSC's and JS runtime's versions so that the `install` script (`node
# vendor_build.js`) copies the correct versions into the `lib/_npm/`
# folder which will be deployed.
- run: npm ci
- name: Set up environment variables for stable deployment
run: |
echo 'SENTRY_ENV=stable' >> "$GITHUB_ENV"
if: github.ref == 'refs/heads/stable'
- name: Set up environment variables for devel deployment
run: |
echo 'SENTRY_ENV=devel' >> "$GITHUB_ENV"
if: github.ref == 'refs/heads/master'
- name: Build
env:
SENTRY_DSN: 'https://[email protected]/202888'
run: ./build
- name: Deploy
env:
BOT_SSH_KEY: ${{secrets.BOT_SSH_KEY}}
OUTDIR: ${{ github.ref == 'refs/heads/master' && 'devel' || '' }}
run: |
./push_artifacts/git_config_kaitai_bot
./push_artifacts/publish \
-o kaitai-io \
-r ide-kaitai-io.github.io \
-d "$OUTDIR" \
-m "Regen ${GITHUB_REF#refs/heads/*} $GITHUB_REPOSITORY@$GITHUB_SHA" \
-- \
--exclude=.git \
--exclude=.github/ \
--exclude=.nojekyll \
--exclude=_build/ \
--exclude=CNAME \
--exclude=favicon.ico \
--exclude=favicon.ico.license \
--exclude=devel/ \
out/