From 2b6cfd5118a8563ab85abb4405e46082a5040b75 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Sat, 24 Aug 2024 13:29:23 +0200 Subject: [PATCH] GH Actions: fix deployment of `@next` versions in /devel The change in 03de7ce3bb82f8b5526cb8618c18435149c8a3fd actually didn't have any effect on the `out/` directory because `lib/_npm/` was last updated by `npm ci` (because `node vendor_build.js` is registered as an `install` script) when `package-lock.json` still contained the old versions. --- .github/workflows/main.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4b29f05d..96eb3d9b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,17 +35,20 @@ jobs: - 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 - node vendor_build.js - if: github.ref == 'refs/heads/stable' - - name: Use devel versions of KSC and JS runtime + - 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 update kaitai-struct-compiler kaitai-struct - if: github.ref == 'refs/heads/master' + 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: |