68 lines (63 loc) · 1.55 KB
/
release.yaml
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: Release
on:
push:
tags:
- "v*"
jobs:
verup:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Get version
id: get_version
run: echo "version=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
with:
ref: master
fetch-depth: 0
- name: Update package version
run: |
npm version from-git --no-git-tag-version
- name: Commit and push
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Update version to ${{ steps.get_version.outputs.version }}"
git push -u origin master
build-and-release-package:
runs-on: ubuntu-latest
needs:
- verup
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: master
- uses: actions/setup-node@v3
with:
node-version: '20.x'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- run: npm install -g npm
- run: npm ci
- run: npm run build
- run: npm publish --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
release:
runs-on: ubuntu-latest
needs:
- verup
permissions:
contents: write
steps:
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true