Skip to content

Commit

Permalink
build: add release script and ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongkyuuuu committed Sep 13, 2023
1 parent 64dbe2a commit 6335274
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/release-by-tag-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
push:
tags:
- "v*"

name: Create Release

jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Release
uses: softprops/action-gh-release@v1
with:
body: |
Please refer to [CHANGELOG.md](https://github.com/DongKyuuuu/vue3-recaptcha-v2/blob/main/CHANGELOG.md) for details.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"scripts": {
"build": "vite build -c ./vite.config.ts",
"dev": "vite ./playground",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1"
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
"release": "sh scripts/release.sh"
},
"peerDependencies": {
"vue": "^3"
Expand Down
32 changes: 32 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# #!/bin/bash
set -e

BUMP_LIST=("major" "minor" "patch")

echo "Current version:" $(grep version package.json | sed -E 's/^.*"([0-9][^"]+)".*$/\1/')
echo
for i in "${!BUMP_LIST[@]}"; do
echo " $(($i + 1)). ${BUMP_LIST[$i]}"
done
read - p "Select version 👉" -n 1 -r
BUMP=${BUMP_LIST[$REPLY - 1]}

# Bump version
yarn version $BUMP
yarn build

# ChangeLog
yarn changelog
echo "Please check the git history and the changelog and press enter"
read OKAY

# Commit and tag
git add CHANGELOG.md package.json .yarn/versions/*
git commit -m "release: v$VERSION"
git tag "v$VERSION"


# publish
yarn npm publish
git push origin refs/tags/v$VERSION
git push

0 comments on commit 6335274

Please sign in to comment.