-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathnpm-publish.yml
32 lines (29 loc) · 1 KB
/
npm-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Collaborators can publish a new version of what's on master via "workflow_dispatch"
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
name: Publish
on:
workflow_dispatch:
inputs:
Version:
description: 'Version accepted by `npm version *`'
required: true
jobs:
NPM:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: package.json
registry-url: https://registry.npmjs.org
- run: npm ci || npm install
- uses: fregante/setup-git-user@v2
- run: npm version "${{ github.event.inputs.Version }}"
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: git push --follow-tags
# `git tag` enables support for keywords: `npm version patch`
- run: gh release create "$(git tag --points-at HEAD)" --generate-notes
env:
GH_TOKEN: ${{ github.token }}