mirror of
https://github.com/yanhao98/semantic-release-action-example.git
synced 2025-09-18 12:27:03 +08:00
Initial commit
This commit is contained in:
19
scripts/01.sh
Executable file
19
scripts/01.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
git switch main
|
||||
commit_types=(
|
||||
"feat: 一项新功能"
|
||||
"fix: 错误修复"
|
||||
"docs: 仅更改文档"
|
||||
"style: 不影响代码含义的更改(空格、格式、缺少分号等)"
|
||||
"refactor: 既不修复错误也不添加功能的代码更改"
|
||||
"perf: 提高性能的代码更改"
|
||||
"test: 添加缺失的或纠正现有的测试"
|
||||
"chore: 对构建过程或辅助工具和库(例如文档生成)的更改"
|
||||
)
|
||||
i=1
|
||||
for commit_type in "${commit_types[@]}"; do
|
||||
git commit --allow-empty -m "$commit_type $i. $(date) on $(git rev-parse --abbrev-ref HEAD)"
|
||||
((i++))
|
||||
done
|
||||
git push origin main:main
|
23
scripts/02.sh
Executable file
23
scripts/02.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
rm -f CHANGELOG.md
|
||||
git fetch
|
||||
latest_tag=$(git describe --tags "$(git rev-list --tags --max-count=1)")
|
||||
git tag -l | xargs -I {} git push origin :refs/tags/{}
|
||||
git tag -l | xargs git tag -d
|
||||
git switch main
|
||||
git checkout --orphan temp_branch
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
git branch -D main
|
||||
git branch -m main
|
||||
git branch --set-upstream-to=origin/main main
|
||||
for branch in $(git branch | grep -v "main"); do
|
||||
git push origin --delete "$branch"
|
||||
git branch -D "$branch"
|
||||
done
|
||||
git push -f origin main
|
||||
git tag "$latest_tag"
|
||||
git push origin "$latest_tag"
|
Reference in New Issue
Block a user