GH Actions: better run name when rebuilding with new KSC #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
- run: npm ci | |
- name: Use stable versions of KSC and JS runtime | |
run: | | |
npm install kaitai-struct-compiler@latest kaitai-struct@latest | |
if: github.ref == 'refs/heads/stable' | |
- name: Use devel versions of KSC and JS runtime | |
run: | | |
npm update kaitai-struct-compiler kaitai-struct | |
if: github.ref == 'refs/heads/master' | |
- 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/ |