Simplify releases with a script

This commit is contained in:
Nick Groenen 2021-09-24 11:58:27 +02:00
parent c4bc77402e
commit f70d6b0cf0
No known key found for this signature in database
GPG Key ID: 4F0AD019928AE098
2 changed files with 39 additions and 9 deletions

View File

@ -1,14 +1,7 @@
# Release process # Release process
- [ ] Update version number in `Cargo.toml` - [ ] Run `./make-new-release.sh`
- [ ] Run `cargo check` - [ ] Push the created release commit/tag to GitHub
- [ ] Commit changes to `Cargo.*` with the message format `Release vN.N.N`
- [ ] Make git tag `vN.N.N`
- [ ] Run `gitchangelog`, review and make any manual adjustments as needed
- [ ] Regenerate README: `docs/generate.sh`
- [ ] Stage `CHANGES.md`, `README.md` and amend previous commit
- [ ] Force update git tag `vN.N.N`
- [ ] Push changes & tag
- [ ] Wait for builds to turn green (<https://github.com/zoni/obsidian-export/actions>) - [ ] Wait for builds to turn green (<https://github.com/zoni/obsidian-export/actions>)
- [ ] Run `cargo publish` - [ ] Run `cargo publish`
- [ ] Publish drafted release (<https://github.com/zoni/obsidian-export/releases>) - [ ] Publish drafted release (<https://github.com/zoni/obsidian-export/releases>)

37
make-new-release.sh Executable file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail
get_next_version_number() {
DATEPART=$(date +%y.%-m)
ITERATION=0
while true; do
VERSION_STRING="${DATEPART}.${ITERATION}"
if git rev-list "v$VERSION_STRING" > /dev/null 2>&1; then
((ITERATION++))
else
echo "$VERSION_STRING"
return
fi
done
}
VERSION=$(get_next_version_number)
sed -i -E "s/^version = \".+\"$/version = \"${VERSION}\"/" Cargo.toml
cargo check
git commit "Cargo.*" --message "Release v${VERSION}"
git tag "v${VERSION}"
gitchangelog
${EDITOR:-vim} CHANGES.md
docs/generate.sh
git add CHANGES.md README.md
git commit --amend --no-edit
git tag "v${VERSION}" --force
printf "\n\nSuccessfully created release %s\n" "v${VERSION}"
printf "\nYou'll probably want to continue with:\n"
printf "\tgit push origin main\n"
printf "\tgit push origin %s\n" "v${VERSION}"