feat(deps): upgrade eslint v9→v10, replace unmaintained plugins (batch 23) #1296
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: Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - "**" | |
| jobs: | |
| cancel-previous: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Cancel Previous Runs | |
| uses: styfle/cancel-workflow-action@0.7.0 | |
| with: | |
| access_token: ${{ github.token }} | |
| check-secret: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| SECRETS_SET: ${{ steps.check-secret.outputs.SECRETS_SET }} | |
| steps: | |
| - id: check-secret | |
| env: | |
| BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
| run: | | |
| echo "SECRETS_SET: ${{ env.BROWSERSTACK_USERNAME != '' }}" | |
| echo "::set-output name=SECRETS_SET::${{ env.BROWSERSTACK_USERNAME != '' }}" | |
| lint: | |
| if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache NPM dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.npm | |
| node_modules | |
| key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.OS }}-npm-cache- | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| - run: npm config set script-shell $(which bash) | |
| - run: npm ci | |
| - run: npm run lint | |
| duplication: | |
| if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" | |
| continue-on-error: true | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache NPM dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.npm | |
| node_modules | |
| key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.OS }}-npm-cache- | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| - run: npm config set script-shell $(which bash) | |
| - run: npm ci | |
| - run: npm run duplication | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: duplication-report | |
| path: report | |
| # audit: | |
| # if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]') && ! startsWith( github.head_ref, 'dependabot' )" | |
| # | |
| # runs-on: ubuntu-latest | |
| # | |
| # defaults: | |
| # run: | |
| # shell: bash | |
| # | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # | |
| # - name: Cache NPM dependencies | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # ~/.npm | |
| # node_modules | |
| # key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| # restore-keys: | | |
| # ${{ runner.OS }}-npm-cache- | |
| # | |
| # - name: Use Node.js 18.x | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 18.x | |
| # - run: npm audit --production | |
| dry-aged-deps: | |
| if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache NPM dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.npm | |
| node_modules | |
| key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.OS }}-npm-cache- | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| - run: npm config set script-shell $(which bash) | |
| - run: npm ci | |
| - run: npx dry-aged-deps --check | |
| # security: | |
| # needs: | |
| # - check-secret | |
| # if: | | |
| # needs.check-secret.outputs.SECRETS_SET == 'true' && | |
| # ! contains(toJSON(github.event.commits.*.message), '[skip-ci]') && ! startsWith( github.head_ref, 'dependabot' ) | |
| # | |
| # runs-on: ubuntu-latest | |
| # | |
| # env: | |
| # SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
| # | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # | |
| # - name: Cache NPM dependencies | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # ~/.npm | |
| # node_modules | |
| # key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| # restore-keys: | | |
| # ${{ runner.OS }}-npm-cache- | |
| # | |
| # - name: Use Node.js 18.x | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 18.x | |
| # - run: npm config set script-shell $(which bash) | |
| # - run: npm ci | |
| # # We've seen situations where snyk is unavailable | |
| # # so do a bit of retry on failure | |
| # - uses: nick-invision/retry@v2 | |
| # with: | |
| # timeout_seconds: 120 | |
| # max_attempts: 3 | |
| # retry_wait_seconds: 10 | |
| # command: npm run security | |
| build: | |
| if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache NPM dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.npm | |
| node_modules | |
| key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.OS }}-npm-cache- | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| - run: npm config set script-shell $(which bash) | |
| - run: npm ci | |
| - run: npm run build | |
| test-node-api: | |
| if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| node-version: [20.x, 22.x] | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache NPM dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.npm | |
| node_modules | |
| key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.OS }}-npm-cache- | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - run: npm config set script-shell $(which bash) | |
| - run: npm ci | |
| - run: npm run test:node-api:not{@skippable} | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: code-coverage-report-node-${{ matrix.node-version }} | |
| path: coverage/node-api | |
| # test-chrome-local: | |
| # if: | | |
| # ! contains(toJSON(github.event.commits.*.message), '[skip-ci]') | |
| # runs-on: ubuntu-latest | |
| # name: test-chrome-local | |
| # defaults: | |
| # run: | |
| # shell: bash | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Cache NPM dependencies | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # ~/.npm | |
| # node_modules | |
| # key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| # restore-keys: | | |
| # ${{ runner.OS }}-npm-cache- | |
| # - name: Use Node.js 12.x | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 12.x | |
| # - run: npm config set script-shell $(which bash) | |
| # - run: npm ci | |
| # - run: npm run cover:browser-api:chrome:local | |
| # - uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: code-coverage-report-chrome-local | |
| # path: coverage/browser-api-chrome-local | |
| # test-chrome-local-min: | |
| # if: | | |
| # ! contains(toJSON(github.event.commits.*.message), '[skip-ci]') | |
| # continue-on-error: true | |
| # runs-on: ubuntu-latest | |
| # name: test-chrome-local-min | |
| # defaults: | |
| # run: | |
| # shell: bash | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Cache NPM dependencies | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # ~/.npm | |
| # node_modules | |
| # key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| # restore-keys: | | |
| # ${{ runner.OS }}-npm-cache- | |
| # - name: Use Node.js 12.x | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 12.x | |
| # - run: npm config set script-shell $(which bash) | |
| # - run: npm ci | |
| # - run: npm run test:browser-api-min:chrome:local | |
| # test-firefox-local: | |
| # if: | | |
| # ! contains(toJSON(github.event.commits.*.message), '[skip-ci]') | |
| # continue-on-error: true | |
| # runs-on: ubuntu-latest | |
| # name: test-firefox-local | |
| # defaults: | |
| # run: | |
| # shell: bash | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Cache NPM dependencies | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # ~/.npm | |
| # node_modules | |
| # key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| # restore-keys: | | |
| # ${{ runner.OS }}-npm-cache- | |
| # - name: Use Node.js 12.x | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 12.x | |
| # - run: npm config set script-shell $(which bash) | |
| # - run: npm ci | |
| # - run: npm run cover:browser-api:firefox:local | |
| # - uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: code-coverage-report-firefox-local | |
| # path: coverage/browser-api-firefox-local | |
| # check-coverage-local: | |
| # if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]') && ! startsWith( github.head_ref, 'dependabot' )" | |
| # needs: | |
| # - test-node-api | |
| # - test-chrome-local | |
| # runs-on: ubuntu-latest | |
| # defaults: | |
| # run: | |
| # shell: bash | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Cache NPM dependencies | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # ~/.npm | |
| # node_modules | |
| # key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| # restore-keys: | | |
| # ${{ runner.OS }}-npm-cache- | |
| # - name: Use Node.js 12.x | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 12.x | |
| # - run: npm config set script-shell $(which bash) | |
| # - run: npm ci | |
| # - uses: actions/download-artifact@v2 | |
| # - run: mkdir -p coverage | |
| # - run: | | |
| # for directory in $(ls -d code-coverage-report-*); do | |
| # mv "${directory}" "coverage/." | |
| # done | |
| # ls -l coverage | |
| # - run: npm run report:cover | |
| # # some of the tests can be skipped if the external system is not available | |
| # # this is part of a test run to make sure we still have coverage even if | |
| # # those tests don't run | |
| # test-node-api-not-skippable: | |
| # if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" | |
| # runs-on: ubuntu-latest | |
| # defaults: | |
| # run: | |
| # shell: bash | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Cache NPM dependencies | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # ~/.npm | |
| # node_modules | |
| # key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| # restore-keys: | | |
| # ${{ runner.OS }}-npm-cache- | |
| # - uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 14.x | |
| # - run: npm config set script-shell $(which bash) | |
| # - run: npm ci | |
| # - run: npm run cover:node-api:not{@skippable} | |
| # env: | |
| # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| # - uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: code-coverage-report-node-not-skippable-14.x | |
| # path: coverage/node-api-not--skippable- | |
| # test-chrome-local-not-skippable: | |
| # if: | | |
| # ! contains(toJSON(github.event.commits.*.message), '[skip-ci]') | |
| # runs-on: ubuntu-latest | |
| # name: test-chrome-local-not-skippable | |
| # defaults: | |
| # run: | |
| # shell: bash | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Cache NPM dependencies | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # ~/.npm | |
| # node_modules | |
| # key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| # restore-keys: | | |
| # ${{ runner.OS }}-npm-cache- | |
| # - name: Use Node.js 12.x | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 12.x | |
| # - run: npm config set script-shell $(which bash) | |
| # - run: npm ci | |
| # - run: npm run cover:browser-api:chrome:local:not{@skippable} | |
| # - uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: code-coverage-report-chrome-local-not-skippable | |
| # path: coverage/browser-api-chrome-local-not--skippable- | |
| # check-coverage-local-not-skippable: | |
| # if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]') && ! startsWith( github.head_ref, 'dependabot' )" | |
| # needs: | |
| # - test-node-api-not-skippable | |
| # - test-chrome-local-not-skippable | |
| # runs-on: ubuntu-latest | |
| # defaults: | |
| # run: | |
| # shell: bash | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Cache NPM dependencies | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # ~/.npm | |
| # node_modules | |
| # key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| # restore-keys: | | |
| # ${{ runner.OS }}-npm-cache- | |
| # - name: Use Node.js 12.x | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 12.x | |
| # - run: npm config set script-shell $(which bash) | |
| # - run: npm ci | |
| # - uses: actions/download-artifact@v2 | |
| # - run: mkdir -p coverage | |
| # - run: | | |
| # for directory in $(ls -d code-coverage-report-*); do | |
| # mv "${directory}" "coverage/." | |
| # done | |
| # ls -l coverage | |
| # - run: npm run report:cover | |
| # get-browser-list: | |
| # needs: | |
| # - check-secret | |
| # if: | | |
| # needs.check-secret.outputs.SECRETS_SET == 'true' && | |
| # ! contains(toJSON(github.event.commits.*.message), '[skip-ci]') | |
| # runs-on: ubuntu-latest | |
| # outputs: | |
| # matrix-1: ${{ steps.set-matrix-1.outputs.matrix-1 }} | |
| # defaults: | |
| # run: | |
| # shell: bash | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Cache NPM dependencies | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # ~/.npm | |
| # node_modules | |
| # key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| # restore-keys: | | |
| # ${{ runner.OS }}-npm-cache- | |
| # - name: Use Node.js 12.x | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 12.x | |
| # - run: npm config set script-shell $(which bash) | |
| # - run: npm ci | |
| # - run: npm run --silent json:list-github-actions-browser-matrix:1 > browser-matrix-1.json | |
| # - id: set-matrix-1 | |
| # run: echo "::set-output name=matrix-1::$(cat browser-matrix-1.json)" | |
| # test-browser-api-1: | |
| # needs: | |
| # - check-secret | |
| # - get-browser-list | |
| # if: | | |
| # needs.check-secret.outputs.SECRETS_SET == 'true' && | |
| # ! contains(toJSON(github.event.commits.*.message), '[skip-ci]') | |
| # runs-on: ubuntu-latest | |
| # name: test-${{ matrix.browser }}-remote | |
| # strategy: | |
| # matrix: ${{fromJson(needs.get-browser-list.outputs.matrix-1)}} | |
| # defaults: | |
| # run: | |
| # shell: bash | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Cache NPM dependencies | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # ~/.npm | |
| # node_modules | |
| # key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| # restore-keys: | | |
| # ${{ runner.OS }}-npm-cache- | |
| # - name: Use Node.js 12.x | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 12.x | |
| # - run: npm config set script-shell $(which bash) | |
| # - run: npm ci | |
| # - uses: "browserstack/github-actions/setup-env@v1.0.1" | |
| # with: | |
| # username: ${{ secrets.BROWSERSTACK_USERNAME }} | |
| # access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
| # # browserstack can be moody at times, so let | |
| # # the pipeline have a few cracks at it | |
| # ### FIRST ATTEMPT ### | |
| # # wait for availability | |
| # - run: npm run wait-for-browser-stack | |
| # env: | |
| # BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
| # BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
| # # run tests | |
| # - id: attempt-1 | |
| # run: timeout 30m npm run cover:browser-api:${{ matrix.browser }}:remote && echo "::set-output name=result::success" | |
| # timeout-minutes: 30 | |
| # continue-on-error: true | |
| # ### SECOND ATTEMPT ### | |
| # # wait for availability | |
| # - run: npm run wait-for-browser-stack | |
| # if: steps.attempt-1.outputs.result != 'success' | |
| # env: | |
| # BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
| # BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
| # # run tests | |
| # - id: attempt-2 | |
| # if: steps.attempt-1.outputs.result != 'success' | |
| # run: timeout 30m npm run cover:browser-api:${{ matrix.browser }}:remote && echo "::set-output name=result::success" | |
| # timeout-minutes: 30 | |
| # continue-on-error: true | |
| # ### THIRD ATTEMPT ### | |
| # # wait for availability | |
| # - run: npm run wait-for-browser-stack | |
| # if: steps.attempt-1.outputs.result != 'success' && steps.attempt-2.outputs.result != 'success' | |
| # env: | |
| # BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | |
| # BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | |
| # # run tests | |
| # - id: attempt-3 | |
| # if: steps.attempt-1.outputs.result != 'success' && steps.attempt-2.outputs.result != 'success' | |
| # run: timeout 30m npm run cover:browser-api:${{ matrix.browser }}:remote && echo "::set-output name=result::success" | |
| # timeout-minutes: 30 | |
| # continue-on-error: true | |
| # # fail if the third attempt failed | |
| # - run: exit 1 | |
| # if: steps.attempt-1.outputs.result != 'success' && steps.attempt-2.outputs.result != 'success' && steps.attempt-3.outputs.result != 'success' | |
| # - uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: code-coverage-report-${{ matrix.browser }} | |
| # path: coverage/browser-api-${{ matrix.browser }}-remote | |
| # check-coverage: | |
| # if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]') && ! startsWith( github.head_ref, 'dependabot' )" | |
| # needs: | |
| # - test-node-api | |
| # - test-browser-api-1 | |
| # runs-on: ubuntu-latest | |
| # defaults: | |
| # run: | |
| # shell: bash | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Cache NPM dependencies | |
| # uses: actions/cache@v4 | |
| # with: | |
| # path: | | |
| # ~/.npm | |
| # node_modules | |
| # key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| # restore-keys: | | |
| # ${{ runner.OS }}-npm-cache- | |
| # - name: Use Node.js 12.x | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: 12.x | |
| # - run: npm config set script-shell $(which bash) | |
| # - run: npm ci | |
| # - uses: actions/download-artifact@v2 | |
| # - run: mkdir -p coverage | |
| # - run: | | |
| # for directory in $(ls -d code-coverage-report-*); do | |
| # mv "${directory}" "coverage/." | |
| # done | |
| # ls -l coverage | |
| # - run: npm run report:cover | |
| # - uses: codacy/codacy-coverage-reporter-action@master | |
| # if: always() | |
| # continue-on-error: true | |
| # with: | |
| # project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
| # coverage-reports: coverage/full/lcov.info | |
| publish: | |
| needs: | |
| - check-secret | |
| - test-node-api | |
| # - check-coverage-local-not-skippable | |
| # - check-coverage | |
| - lint | |
| # - audit | |
| - dry-aged-deps | |
| # - security | |
| - build | |
| - duplication | |
| if: | | |
| needs.check-secret.outputs.SECRETS_SET == 'true' && | |
| github.ref == 'refs/heads/main' && | |
| ! contains(toJSON(github.event.commits.*.message), '[skip-ci]') && | |
| ! contains(toJSON(github.event.commits.*.message), '[skip-release]') | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache NPM dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.npm | |
| node_modules | |
| key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.OS }}-npm-cache- | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| registry-url: https://registry.npmjs.org/ | |
| - name: Publish and Tag | |
| run: | | |
| npm config set script-shell $(which bash) | |
| PACKAGE_NAME=$(node -p "require('./package.json').name") | |
| CURRENT_VERSION=$(npm --unsafe-perm show "${PACKAGE_NAME}" version) | |
| PACKAGE_VERSION=$(node -p "require('./package.json').version") | |
| echo "CURRENT_VERSION=${CURRENT_VERSION}" | |
| echo "PACKAGE_VERSION=${PACKAGE_VERSION}" | |
| if [ "$CURRENT_VERSION" = "$PACKAGE_VERSION" ]; then | |
| echo "Version ${PACKAGE_VERSION} has already been published" | |
| echo "PACKAGE_VERSION=" >> $GITHUB_ENV | |
| else | |
| npm ci | |
| # need to bump version in README.md to PACKAGE_VERSION | |
| # so that the correct version appears on npmjs.com | |
| npm run sync-readme-version | |
| npm run change-log | |
| npm run release-notes | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git add README.md | |
| git add CHANGELOG.md | |
| git commit -m "chore(release): updated CHANGELOG.md and version in README.md to $PACKAGE_VERSION [skip-ci]" | |
| npm pack | |
| npm run do-publish | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git tag "v${PACKAGE_VERSION}" | |
| git pull --rebase | |
| git push --tags | |
| echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV | |
| fi | |
| PACKAGE_NAME_WITHOUT_AT="${PACKAGE_NAME#@}" | |
| echo "TGZ_NAME=${PACKAGE_NAME_WITHOUT_AT//\//-}" >> $GITHUB_ENV | |
| env: | |
| NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
| - name: Create Release | |
| if: ${{ env.PACKAGE_VERSION != '' }} | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
| with: | |
| tag_name: v${{ env.PACKAGE_VERSION }} | |
| release_name: Release v${{ env.PACKAGE_VERSION }} | |
| draft: false | |
| prerelease: false | |
| body_path: RELEASE.md | |
| - name: Upload Release Asset | |
| if: ${{ env.PACKAGE_VERSION != '' }} | |
| id: upload-release-asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
| asset_path: ./${{ env.TGZ_NAME }}-${{ env.PACKAGE_VERSION }}.tgz | |
| asset_name: ${{ env.TGZ_NAME }}-${{ env.PACKAGE_VERSION }}.tgz | |
| asset_content_type: application/gzip | |
| - name: Bump Version | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| npm ci | |
| npm --unsafe-perm --no-git-tag-version version $(npm run --silent get-release-type) | |
| git add package.json | |
| git add package-lock.json | |
| # We don't want to bump the version in the README.md | |
| # otherwise people reading on github will try to | |
| # use the unreleased version. | |
| # instead, we need to update it, just before we pack and tag | |
| NEXT_VERSION=$(node -p "require('./package.json').version") | |
| git commit -m "chore(release): version bump to $NEXT_VERSION. :tada: [skip-ci]" | |
| git pull --rebase | |
| git push origin HEAD:main | |
| not-publish: | |
| needs: | |
| - check-secret | |
| - test-node-api | |
| # - check-coverage-local | |
| # - check-coverage-local-not-skippable | |
| # - check-coverage | |
| - lint | |
| # - audit | |
| - dry-aged-deps | |
| # - security | |
| - build | |
| - duplication | |
| if: | | |
| !(needs.check-secret.outputs.SECRETS_SET == 'true' && | |
| github.ref == 'refs/heads/main') && | |
| ! contains(toJSON(github.event.commits.*.message), '[skip-ci]') && | |
| ! contains(toJSON(github.event.commits.*.message), '[skip-release]') | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - run: | | |
| echo "this is just to make sure the dependant jobs passed" |