Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto release script #2736

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CODING_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,15 @@ meson setup /tmp/i18n-build
meson compile -C /tmp/i18n-build/ bottles-pot
meson compile -C /tmp/i18n-build/ bottles-update-po
```

## Release

Version number should ALWAYS include minor version

- Use `50.0`, `50.1` instead of `50`, `50.1`

To release, run release script to set up everything

```bash
./utils/release.sh
```
4 changes: 0 additions & 4 deletions VERSION_UPDATE.md

This file was deleted.

51 changes: 51 additions & 0 deletions utils/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
VER=$(cat ./VERSION)
echo "- Current version: ${VER}"
echo -n "New version (e.g 50.0): "
read -r NEW_VER

echo "- Updating ./VERSION"
echo -n "$NEW_VER" >./VERSION

echo "- Updating ./meson.build"
sed -i -e "s/version: '${VER}'/version: '${NEW_VER}'/g" ./meson.build

FILE=./data/com.usebottles.bottles.metainfo.xml.in
POS=$(grep -n "<releases>" ${FILE} | cut -f1 -d:)

echo "- Adding stub release description to ${FILE}"
sed -i -e "${POS}r /dev/stdin" ${FILE} <<EOT
<release version="${NEW_VER}" date="$(date -Idate)">
StoneMoe marked this conversation as resolved.
Show resolved Hide resolved
<description translatable="no">
<ul>
<li>TODO: edit me</li>
<li>TODO: edit me</li>
<li>TODO: edit me</li>
</ul>
</description>
</release>
EOT

echo "Press Enter to edit ${FILE}"
read -r
${EDITOR:-vim} +"$POS" $FILE

echo "- Adding commit"
git add -A
git commit -m "release: ${NEW_VER}"

echo "- Tagging commit"
git tag "${NEW_VER}"

cat <<EOT
======= Release Ready =======
A new commit for release '${NEW_VER}' is created.
Push it if everything looks good

git push --follow-tags

Otherwise revert it by

git tag --delete ${NEW_VER} && git reset --soft HEAD~

EOT