Skip to content

build: add permissions to publish package #2

build: add permissions to publish package

build: add permissions to publish package #2

Workflow file for this run

name: Test, build and publish
on:
push:
branches:
- master
env:
CI: true
permissions:
contents: write
packages: write
jobs:
test-build-publish:
name: Test and build
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 18, 20, 22 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
name: Setup node ${{ matrix.node }}
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Test
run: npm run test
- name: Build
run: npm run build
- name: Publish package
if: ${{ matrix.node == '22' }}
run: npx semantic-release
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
NPM_TOKEN: ${{secrets.GITHUB_TOKEN}}