Skip to content

Commit 19e75fb

Browse files
add release workflow and release.sh
1 parent 7624448 commit 19e75fb

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release Notes and NPM Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
release-notes:
10+
name: Release Notes
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: marcantondahmen/release-notes-action@master
14+
with:
15+
repo_token: ${{ secrets.GITHUB_TOKEN }}
16+
prerelease: false
17+
draft: false
18+
filter: "^(feat|fix|refactor|docs)"
19+
strict: true
20+
npm-publish:
21+
name: NPM Publish
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@master
26+
with:
27+
persist-credentials: false
28+
- name: Use Node.js
29+
uses: actions/setup-node@v3
30+
with:
31+
node-version: "18.x"
32+
registry-url: "https://registry.npmjs.org"
33+
- name: Install
34+
run: npm ci
35+
- name: Build
36+
run: npm run build
37+
- name: Publish
38+
run: npm publish
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

bin/release.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/sh
2+
3+
if [[ $(git status -s) ]]; then
4+
echo "Working directory is not clean!"
5+
git status -s
6+
echo
7+
fi
8+
9+
echo "Choose type of release:"
10+
echo
11+
echo " 1) Patch (default)"
12+
echo " 2) Minor"
13+
echo " 3) Major"
14+
echo
15+
read -n 1 -p "Please select a number or press Enter for a patch: " option
16+
echo
17+
18+
case $option in
19+
1) version=patch ;;
20+
2) version=minor ;;
21+
3) version=major ;;
22+
*) version=patch ;;
23+
esac
24+
25+
while true; do
26+
read -p "Create $version version? (y/n) " continue
27+
case $continue in
28+
[Yy]*)
29+
break
30+
;;
31+
[Nn]*)
32+
exit 0
33+
;;
34+
*)
35+
echo "Please only enter \"y\" or \"n\"."
36+
;;
37+
esac
38+
done
39+
echo
40+
41+
npm version $version
42+
git push origin && git push origin --tags

0 commit comments

Comments
 (0)