-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcreate-release.sh
executable file
·42 lines (26 loc) · 1.13 KB
/
create-release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
IMAGE=$1
OLD_VERSION=$2
VERSION=$3
command -v git-cliff >/dev/null 2>&1 || { echo >&2 "This script uses https://github.com/orhun/git-cliff, but it is not installed. Aborting."; exit 1; }
command -v gh >/dev/null 2>&1 || { echo >&2 "This script uses https://cli.github.com/, but it is not installed. Aborting."; exit 1; }
GH_PAGER="" gh release list >/dev/null 2>&1 || { echo >&2 "The GitHub cli is not configured. Aborting."; exit 1; }
git checkout main
git pull
git-cliff --tag=${VERSION} --strip=header ${OLD_VERSION}.. > .tmp.release_info
git-cliff -o --tag=${VERSION} --strip=header
sed -i -e "s/^version = \"${OLD_VERSION}\"/version = \"${VERSION}\"/" Cargo.toml
cargo build
git add Cargo.lock Cargo.toml CHANGELOG.md
git commit -m "release: ${VERSION}" -s
git tag -a "${VERSION}" -F .tmp.release_info
git push
git push --tags
gh release create --verify-tag -F .tmp.release_info -t "${VERSION}" ${VERSION}
git pull
git checkout ${VERSION}
docker build --progress=plain -t "${IMAGE}:${VERSION}" .
if test -f "create-release-post.sh"; then
sh create-release-post.sh "${IMAGE}" "${OLD_VERSION}" "${VERSION}"
fi
git checkout main