🔧 Rename package for publishing to NPM #17
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
name: Run CI | |
# Run this workflow every time a new commit pushed to your repository | |
on: | |
push: | |
branches: | |
- maykin-4.13.12 | |
tags: | |
- '*' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Create 'production' build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Build | |
run: | | |
npm install | |
npm run build | |
unit-tests: | |
name: Run unit tests | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Install dependencies | |
run: npm install --include=dev | |
- name: Run unit tests | |
run: | | |
npm run test | |
publish: | |
name: Publish the NPM package | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- unit-tests | |
# do not publish in forks or non-tag pushes | |
if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'open-formulieren' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@open-formulieren' | |
- name: Build | |
run: | | |
npm install | |
npm run build | |
- name: Publish package to NPM | |
run: | | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |