-
Notifications
You must be signed in to change notification settings - Fork 13
68 lines (58 loc) · 1.64 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Publish to NPM
on:
workflow_dispatch:
inputs:
version:
description: "Version to publish"
required: true
type: "string"
tag:
description: "Tag to publish"
required: true
type: "string"
default: "latest"
commit:
description: "Should we commit the version bump?"
required: false
type: "boolean"
default: true
defaults:
run:
working-directory: .
jobs:
publish:
runs-on: ubuntu-latest
name: "Publish to NPM"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Set node version to 20
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
- name: Install
run: pnpm install
- name: Set up git user
run: |
git config --global user.name "GitHub Action Bot"
git config --global user.email "<>"
- name: Bump version
run: "./version ${{ github.event.inputs.version }}"
- name: "Publish to NPM"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm -r publish --access public --no-git-checks --tag ${{ github.event.inputs.tag }}
- name: "Commit version bump"
if: ${{ github.event.inputs.commit == 'true' }}
run: |
git status
git commit -am "release: ${{ github.event.inputs.version }}"
git push
git tag ${{ github.event.inputs.version }}
git push --tags