-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (41 loc) · 1.35 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
name: Publish to NPM
on:
release:
tags:
- '**-[0-9]+.[0-9]+.[0-9]+'
- '**-[0-9]+.[0-9]+.[0-9]+-*'
types: [published]
jobs:
build-and-publish:
name: 🚀 Publish to NPM
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.target_commitish }}
- uses: pnpm/[email protected]
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- name: Install
run: pnpm install
- name: Preparing environment for release
run: |
VERSION=$(echo $GITHUB_REF_NAME | sed 's/^.*[A-Za-z]-//g')
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "PACKAGE=$(echo $GITHUB_REF_NAME | sed "s/-${VERSION}//g")" >> $GITHUB_ENV
- name: Release
run: |
git config --global user.name "Automated NPM Release"
git config --global user.email "[email protected]"
echo "Publishing $PACKAGE @ $VERSION"
pnpm config set registry https://registry.npmjs.org/
pnpm publish .
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Update the package version number
run: git push
env:
github-token: ${{ secrets.GITHUB_TOKEN }}