Skip to content

Commit e28c82d

Browse files
committed
ci: add release action
1 parent 8135935 commit e28c82d

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/release.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
release-npm:
11+
name: Release to NPM (${{ github.ref }})
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout Repository
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Check if Tag on Main
20+
run: |
21+
git checkout main
22+
branch=$(git branch main --contains ${{ github.ref }})
23+
git checkout ${{ github.ref }}
24+
if [ -z $branch ]; then
25+
echo "Tag ${{ github.ref }} is not contained in the main branch."
26+
exit 1
27+
fi
28+
29+
- name: Setup PNPM
30+
uses: pnpm/action-setup@v2.2.4
31+
with:
32+
version: latest
33+
run_install: true
34+
35+
- name: Test
36+
run: pnpm test
37+
38+
- name: Publish
39+
run: |
40+
pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
41+
pnpm publish --verbose --access public --no-git-checks
42+
43+
release-note:
44+
name: Release Note (${{ github.ref }})
45+
runs-on: ubuntu-latest
46+
needs:
47+
- release-npm
48+
steps:
49+
- name: Checkout Repository
50+
uses: actions/checkout@v3
51+
with:
52+
fetch-depth: 0
53+
54+
- name: Publish Release
55+
uses: "marvinpinto/action-automatic-releases@latest"
56+
with:
57+
repo_token: "${{ secrets.GH_TOKEN }}"
58+
prerelease: false
59+
files: |
60+
README.md
61+
LICENSE

0 commit comments

Comments
 (0)