From 19e75fb9485d0d5cfa8d1e4a5e1b4071cbc8eae0 Mon Sep 17 00:00:00 2001 From: Marc Anton Dahmen Date: Thu, 25 Jan 2024 11:51:25 +0100 Subject: [PATCH] add release workflow and release.sh --- .github/workflows/release.yml | 40 +++++++++++++++++++++++++++++++++ bin/release.sh | 42 +++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 bin/release.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..a5267d6f6 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/bin/release.sh b/bin/release.sh new file mode 100644 index 000000000..aedef3dd8 --- /dev/null +++ b/bin/release.sh @@ -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