Skip to content

Publish Package to npmjs #17

Publish Package to npmjs

Publish Package to npmjs #17

Workflow file for this run

name: Publish Package to npmjs
on:
workflow_dispatch:
inputs:
version:
description: 'Overwrite the version to publish to npmjs (e.g. 1.0.0)'
type: string
required: false
push:
tags:
- "v*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set node-version
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org/'
node-version-file: 'package.json'
- name: Build
run: make build
- name: Prettier
run: make prettier
- name: Test
run: make test
- run: gh release create ${{ github.event.inputs.version || github.ref_name }} --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set node-version
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org/'
node-version-file: 'package.json'
- name: Build
run: make build
- name: Prettier
run: make prettier
- run: npm version --no-commit-hooks --no-git-tag-version ${{ github.event.inputs.version || github.ref_name }}
- run: make publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}