-
-
Notifications
You must be signed in to change notification settings - Fork 12
42 lines (34 loc) · 1.05 KB
/
release.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
name: Release
on:
push:
branches: [main]
jobs:
release:
if: startsWith(github.event.head_commit.message, 'release')
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write # for `npm publish --provenance`
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/pnpm
- name: Build
run: pnpm run build
- name: Extract version from commit message
run: |
VERSION=$(echo "${{ github.event.head_commit.message }}" | grep -oP 'release: \Kv[0-9]+\.[0-9]+\.[0-9]+')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create and push tag
run: |
git tag ${{ env.VERSION }}
git push origin ${{ env.VERSION }}
- run: npx changelogithub
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to NPM
run: npm publish --tag latest --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}