Skip to content

Commit bd661b9

Browse files
committed
ci: add release ci
1 parent dbe5dcf commit bd661b9

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
release-npm:
11+
name: Release 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.2
31+
with:
32+
version: latest
33+
run_install: true
34+
35+
- name: Build & Test
36+
run: pnpm build && pnpm test
37+
38+
- uses: JS-DevTools/npm-publish@v1
39+
with:
40+
token: ${{ secrets.NPM_TOKEN }}
41+
42+
release-note:
43+
name: Release Note (${{ github.ref }})
44+
runs-on: ubuntu-latest
45+
needs:
46+
- release-npm
47+
steps:
48+
- name: Checkout Repository
49+
uses: actions/checkout@v3
50+
with:
51+
fetch-depth: 0
52+
53+
- name: Check if Tag on Main
54+
run: |
55+
git checkout main
56+
branch=$(git branch main --contains ${{ github.ref }})
57+
git checkout ${{ github.ref }}
58+
if [ -z $branch ]; then
59+
echo "Tag ${{ github.ref }} is not contained in the main branch."
60+
exit 1
61+
fi
62+
63+
- name: Publish Release
64+
uses: "marvinpinto/action-automatic-releases@latest"
65+
with:
66+
repo_token: "${{ secrets.GH_TOKEN }}"
67+
prerelease: false
68+
files: |
69+
README.md
70+
LICENSE

0 commit comments

Comments
 (0)