Bump actions/setup-node from 4.4.0 to 6.0.0 #1129
This file contains hidden or 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
| # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
| name: Node.js CI | |
| on: | |
| push: | |
| branches: [master] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: [master] | |
| env: | |
| DEFAULT_NODE_VERSION: "22.x" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [20.x, 22.x, 23.x] | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - run: npm ci | |
| - run: npm run build --if-present | |
| - run: npm run test:prod | |
| env: | |
| NODE_OPTIONS: "--max-old-space-size=8192" | |
| - if: matrix.node-version == env.DEFAULT_NODE_VERSION | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: build | |
| path: | | |
| ./ | |
| !./node_modules/**/* | |
| report-coverage: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: build | |
| - name: Coveralls | |
| uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| deploy-docs: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: build | |
| - name: Deploy Docs | |
| uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs | |
| publish-package-npm: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: build | |
| - name: Use Node.js ${{ env.DEFAULT_NODE_VERSION }} with NPM registry | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: ${{ env.DEFAULT_NODE_VERSION }} | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Publish to NPM | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| publish-package-gpr: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: build | |
| - name: Use Node.js ${{ env.DEFAULT_NODE_VERSION }} with GPR registry | |
| uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0 | |
| with: | |
| node-version: ${{ env.DEFAULT_NODE_VERSION }} | |
| registry-url: "https://npm.pkg.github.com" | |
| - name: Insert repository owner as scope into package name | |
| run: | | |
| node <<EOF | |
| const fs = require('fs').promises; | |
| fs.readFile('package.json', 'utf8').then((data) => JSON.parse(data)).then((json) => { | |
| json.name = '@$(echo "$GITHUB_REPOSITORY" | sed 's/\/.\+//')/' + json.name; | |
| console.info('Package name changed to %s', json.name); | |
| return fs.writeFile('package.json', JSON.stringify(json), 'utf8'); | |
| }).catch(error => { | |
| console.error(error); | |
| process.exit(1); | |
| }); | |
| EOF | |
| - name: Add .npmrc file | |
| run: echo "registry=https://npm.pkg.github.com/ThomasK33" > .npmrc | |
| - name: Publish to GPR | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |