publish-npm: needs: - plan - host {{%- for job in host_jobs %}} - custom-{{{ job.name|safe }}} {{%- endfor %}} runs-on: {{{ global_task.runner }}} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} PLAN: ${{ needs.plan.outputs.val }} if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }} steps: - name: Fetch npm packages uses: actions/download-artifact@v4 with: pattern: artifacts-* path: npm/ merge-multiple: true - uses: actions/setup-node@v4 with: node-version: '20.x' registry-url: 'https://registry.npmjs.org' - run: | for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output) npm publish --access public "./npm/${pkg}" done env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}