Skip to content

Commit 50fbd7b

Browse files
committed
Add a release script
1 parent e3416a7 commit 50fbd7b

File tree

2 files changed

+48
-9
lines changed

2 files changed

+48
-9
lines changed

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,5 @@ For instructions on usage as a Synapse module, see [matrix-http-rendezvous-synap
1717
### Releasing
1818

1919
```sh
20-
git checkout main
21-
cargo set-version --workspace --bump patch
22-
cd synapse/
23-
poetry version patch
24-
cd ..
25-
git commit -a -m "vX.Y.Z"
26-
git tag vX.Y.Z
27-
git push
28-
git push --tags
20+
./release.sh patch
21+
```

release.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/sh
2+
3+
# Use it like that:
4+
#
5+
# sh ./release.sh patch
6+
7+
run () {
8+
echo "+ $*" >&2
9+
# shellcheck disable=SC2048
10+
$*
11+
}
12+
13+
if [ "$#" -ne 1 ]; then
14+
echo "usage: $0 <patch|minor|major>" >&2
15+
exit 1
16+
fi
17+
18+
set -eu
19+
20+
BUMP="$1"
21+
22+
run git checkout main
23+
run git pull
24+
run cargo set-version --workspace --bump "${BUMP}"
25+
26+
run cd synapse/
27+
run poetry version "${BUMP}"
28+
VERSION="v$(poetry version -s)"
29+
run cd ..
30+
31+
run git add Cargo.toml ./*/Cargo.toml synapse/pyproject.toml
32+
run git status
33+
34+
printf "About to commit and push version %s. Are you sure? " "${VERSION}"
35+
read -r REPLY
36+
37+
set -x
38+
case "${REPLY}" in
39+
y|Y|yes|Yes|YES)
40+
run git commit -a -m "${VERSION}"
41+
run git tag -m "${VERSION}" "${VERSION}"
42+
run git push
43+
run git push --tags
44+
;;
45+
*) echo "Aborting." ;;
46+
esac

0 commit comments

Comments
 (0)