Skip to content

ci: migrate from using NPM_TOKEN to npm's Trusted Publishers #360

ci: migrate from using NPM_TOKEN to npm's Trusted Publishers

ci: migrate from using NPM_TOKEN to npm's Trusted Publishers #360

Workflow file for this run

# This workflow will do a clean installation 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, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
strategy:
matrix:
node-version: [20.x, 22.x, 24.x]
steps:
- run: echo "🎉 The job was triggered by a ${{ github.event_name }} event."
- uses: FranzDiebold/github-env-vars-action@v2
- uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Install node_modules
run: yarn
- name: Test & lint
run: yarn test
env:
CI: true
- name: Testing with previous mongoose versions 8
run: yarn test-prev-vers-8
env:
CI: true
- name: Testing with previous mongoose versions 7
run: yarn test-prev-vers-7
env:
CI: true
- name: Testing with previous mongoose versions 6
run: yarn test-prev-vers-6
env:
CI: true
- name: Send codecov.io stats
if: matrix.node-version == '20.x'
run: bash <(curl -s https://codecov.io/bash) || echo ''
publish:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/alpha' || github.ref == 'refs/heads/beta'
needs: [tests]
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
pull-requests: write
id-token: write
steps:
- uses: actions/checkout@v6
- name: Use Node.js 24.x
uses: actions/setup-node@v6
with:
node-version: 24.x
- name: Install node_modules
run: yarn install
- name: Build
run: yarn build
- name: Semantic Release (publish to npm)
run: npx semantic-release@19
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}