Skip to content

Commit

Permalink
add release workflow and release.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
marcantondahmen committed Jan 25, 2024
1 parent 7624448 commit 19e75fb
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release Notes and NPM Publish

on:
push:
tags:
- "*"

jobs:
release-notes:
name: Release Notes
runs-on: ubuntu-latest
steps:
- uses: marcantondahmen/release-notes-action@master
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
draft: false
filter: "^(feat|fix|refactor|docs)"
strict: true
npm-publish:
name: NPM Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
with:
persist-credentials: false
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42 changes: 42 additions & 0 deletions bin/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh

if [[ $(git status -s) ]]; then
echo "Working directory is not clean!"
git status -s
echo
fi

echo "Choose type of release:"
echo
echo " 1) Patch (default)"
echo " 2) Minor"
echo " 3) Major"
echo
read -n 1 -p "Please select a number or press Enter for a patch: " option
echo

case $option in
1) version=patch ;;
2) version=minor ;;
3) version=major ;;
*) version=patch ;;
esac

while true; do
read -p "Create $version version? (y/n) " continue
case $continue in
[Yy]*)
break
;;
[Nn]*)
exit 0
;;
*)
echo "Please only enter \"y\" or \"n\"."
;;
esac
done
echo

npm version $version
git push origin && git push origin --tags

0 comments on commit 19e75fb

Please sign in to comment.