ci: allow to write comments by semantic-release #352
This file contains 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, pull_request] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: write | |
strategy: | |
matrix: | |
node-version: [16.x, 18.x, 20.x] | |
steps: | |
- run: echo "🎉 The job was triggered by a ${{ github.event_name }} event." | |
- uses: styfle/[email protected] | |
with: | |
workflow_id: nodejs.yml | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: FranzDiebold/github-env-vars-action@v2 | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
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 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 == '18.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 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.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 }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |