mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
Some checks failed
Build and push Docker images / docker (push) Has been cancelled
Mirror and run GitLab CI / build (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, linux) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, macos) (push) Has been cancelled
Package Node.js project into an executable / node${{ matrix.nodev }}-${{ matrix.platform }}-x64 (18, win) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (alpine) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linux) (push) Has been cancelled
Package Node.js project into an executable / node18-${{ matrix.platform }}-arm64 (linuxstatic) (push) Has been cancelled
40 lines
868 B
Bash
40 lines
868 B
Bash
#!/usr/bin/env bash
|
|
|
|
# version: <major.minor.patch>
|
|
level=patch
|
|
|
|
OLD_VERSION_ARRAY=($(npm pkg get version | tr -d '"' | tr '.' ' '))
|
|
major=${OLD_VERSION_ARRAY[0]}
|
|
minor=${OLD_VERSION_ARRAY[1]}
|
|
patch=${OLD_VERSION_ARRAY[2]}
|
|
|
|
case "${level}" in
|
|
"major")
|
|
((major += 1))
|
|
minor=0
|
|
patch=0
|
|
;;
|
|
"minor")
|
|
((minor += 1))
|
|
patch=0
|
|
;;
|
|
*)
|
|
((patch += 1))
|
|
;;
|
|
esac
|
|
|
|
npm version $level \
|
|
--no-commit-hooks \
|
|
--no-git-tag-version
|
|
|
|
NEW_VERSION="$major.$minor.$patch"
|
|
|
|
echo "New Version: $NEW_VERSION"
|
|
|
|
GIT_LOG="$(git log --pretty=format:"* %h %s" | sed -e '/CHANGELOG/,$d' | sed ':a;N;s/\n/\\n/g;ta')"
|
|
|
|
sed -i "/# CHANGELOG/a\## 主要变化($NEW_VERSION)\n$GIT_LOG\n\n_如果之前版本小于上一版本,请查看[CHANGELOG](https://github.com/shanmiteko/LotteryAutoScript/blob/main/CHANGELOG.md)变更说明_\n" CHANGELOG.md
|
|
|
|
git add .
|
|
git commit -m "docs: 更新CHANGELOG"
|