Skip to content

Commit 05ebdf9

Browse files
Add publishing workflow (#21)
* Add publishing workflow * Remove `master` branch push trigger for test workflow * Update publisher's Node version to 20 from 16
1 parent 31bed98 commit 05ebdf9

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
on:
2+
release:
3+
types: [created, edited, published]
4+
workflow_dispatch:
5+
inputs:
6+
dryRun:
7+
description: "Dry run only"
8+
required: true
9+
default: true
10+
type: boolean
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: 20
20+
registry-url: "https://registry.npmjs.org"
21+
- run: npm ci
22+
23+
- name: Publish package
24+
env:
25+
NODE_AUTH_TOKEN: ${{ secrets.REGISTRY_PUBLISH_TOKEN }}
26+
if: >
27+
(github.event_name == 'release' && github.event.action == 'published') ||
28+
(github.event_name == 'workflow_dispatch' && !inputs.dryRun)
29+
run: npm publish
30+
31+
- name: Publish package (dry run)
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.REGISTRY_PUBLISH_TOKEN }}
34+
if: >
35+
(github.event_name == 'release' && github.event.action != 'published') ||
36+
(github.event_name == 'workflow_dispatch' && inputs.dryRun)
37+
run: npm publish --dry-run

.github/workflows/tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
on:
22
push:
33
branches:
4-
- master
54
- main
65
pull_request:
76

0 commit comments

Comments
 (0)