Skip to content

NPM build, test and publish #58

NPM build, test and publish

NPM build, test and publish #58

Workflow file for this run

name: npm-publish
run-name: NPM build, test and publish
on:
workflow_dispatch:
push:
branches: [ "main" ]
paths:
- 'package.json'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- name: Update npm dependencies
run: |
npm ci
npm run build
npm run test --if-present
- name: Commit and push changes
uses: EndBug/add-and-commit@v9
with:
add: 'package*.json'
message: 'Bot: npm deps update'
- name: Store build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
dist
package*.json
publish-npmjs-com:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}