From 34c5df39823d2e54a6d304003fe1596b218043cb Mon Sep 17 00:00:00 2001 From: Arjo Bruijnes Date: Fri, 7 Nov 2025 11:06:24 +0100 Subject: [PATCH 1/2] Update publishing workflow to support trusted publishing --- .github/workflows/PublishNpm.yml | 70 ++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/.github/workflows/PublishNpm.yml b/.github/workflows/PublishNpm.yml index c4e3f5eb..de169274 100644 --- a/.github/workflows/PublishNpm.yml +++ b/.github/workflows/PublishNpm.yml @@ -7,44 +7,62 @@ on: - "generator-widget-v*" jobs: + discover: + name: Discover packages to publish + runs-on: ubuntu-latest + outputs: + releases: ${{ steps.export.outputs.releases }} + steps: + - name: Checking-out code + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 + + - name: Get tags for HEAD + id: export + run: | + echo "releases=$( + ( + for tag in $(git tag --points-at HEAD); do + echo "{ \"package\": \"${tag%-v*}\", \"version\": \"${tag##*-v}\" }" + done + ) | jq --slurp '.' + )" >> "$GITHUB_OUTPUT" + publish: name: "Publish NPM packages" runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + release: ${{ fromJSON(needs.discover.outputs.releases) }} + environment: ${{ matrix.release.package }} + steps: - - name: "Checking-out code" - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2 + - name: Check-out code + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 + + - name: Setup node + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: - submodules: false + node-version-file: ".nvmrc" + cache: 'pnpm' - name: Setup pnpm uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda #v4.1.0 with: version: 10 - - name: "Defining Environment Variables" - id: variables - run: echo "::set-output name=tag::$(git tag --points-at HEAD)" - - - name: "Defining node version" - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 - with: - node-version-file: ".nvmrc" - cache: 'pnpm' - - - name: "Installing generator-widget dependencies" + - name: Install dependencies + working-directory: ./packages/${{ matrix.release.package }} run: pnpm install - - name: "Targeting Pluggable Widgets Tools" - if: contains(steps.variables.outputs.tag, 'pluggable-widgets-tools-v') - uses: JS-DevTools/npm-publish@0f451a94170d1699fd50710966d48fb26194d939 # v1 - with: - package: "./packages/pluggable-widgets-tools/package.json" - token: ${{ secrets.NPM_TOKEN }} + - name: Pack package + working-directory: ./packages/${{ matrix.release.package }} + run: pnpm pack - - name: "Targeting Pluggable Widgets Generator" - if: contains(steps.variables.outputs.tag, 'generator-widget-v') - uses: JS-DevTools/npm-publish@0f451a94170d1699fd50710966d48fb26194d939 # v1 - with: - package: "./packages/generator-widget/package.json" - token: ${{ secrets.NPM_TOKEN }} + - name: Prepare npm for publishing + run: npm install -g npm@>11.5.1 # Trusted Publishing with OIDC requires this version or higher + + - name: Publish package + working-directory: ./packages/${{ matrix.release.package }} + run: npm publish mendix-${{ matrix.release.package }}-${{matrix.release.version }}.tgz From 0b3ce449740c79d9970889b508c7fcd3d9c425b5 Mon Sep 17 00:00:00 2001 From: Arjo Bruijnes Date: Fri, 7 Nov 2025 11:18:14 +0100 Subject: [PATCH 2/2] Install a version of node compatible with npm 11.5.1 --- .github/workflows/PublishNpm.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/PublishNpm.yml b/.github/workflows/PublishNpm.yml index de169274..39381f01 100644 --- a/.github/workflows/PublishNpm.yml +++ b/.github/workflows/PublishNpm.yml @@ -60,8 +60,10 @@ jobs: working-directory: ./packages/${{ matrix.release.package }} run: pnpm pack - - name: Prepare npm for publishing - run: npm install -g npm@>11.5.1 # Trusted Publishing with OIDC requires this version or higher + - name: Setup node for npm publishing + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: '24' # Includes a version of npm higher than 11.5.1, which is needed for OIDC - name: Publish package working-directory: ./packages/${{ matrix.release.package }}