chore(release): add release script and instructions

This commit is contained in:
Orhun Parmaksız 2022-04-09 12:17:05 +03:00
parent 2a16fc077a
commit 7ef13a10e8
No known key found for this signature in database
GPG Key ID: F83424824B3E4B90
5 changed files with 54 additions and 5 deletions

11
RELEASE.md Normal file
View File

@ -0,0 +1,11 @@
# Creating a Release
1. Update [CHANGELOG.md](./CHANGELOG.md)
- Do not commit changes yet.
2. Run the [release script](./scripts/release.sh): `./scripts/release.sh v[X.Y.Z]`
- Changes will be committed and a tag will be created.
3. Push the changes: `git push`
- Check if [Continuous Integration](https://github.com/orhun/systeroid/actions) workflow is completed successfully before moving to the next step.
4. Push the tags: `git push --tags`
- [GitHub](https://github.com/orhun/systeroid/releases), [crates.io](https://crates.io/crates/systeroid/), and [Docker Hub](https://hub.docker.com/r/orhunp/systeroid) releases are automated via [GitHub actions](./.github/workflows/cd.yml) and triggered by pushing a tag.
5. Check the status of [Continuous Deployment](https://github.com/orhun/systeroid/actions) workflow.

38
scripts/release.sh Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -e
changelog_file="CHANGELOG.md"
version_suffix="# managed by release.sh"
commit_prefix="chore(release): prepare for "
tag_prefix="Release "
tagger_name="systeroid project"
tagger_email="systeroid@protonmail.com"
signing_key="03598A29AA9D297B8D6D94F1EBEB8A69FDA3720E"
usage() { printf "usage: %s <tag>\n" "${BASH_SOURCE[0]##*/}"; exit 0; }
bail() { printf "error: %s\n" "$1" "${@:2}"; exit 1; }
[ -z "$1" ] && usage
[[ "$1" != v* ]] && bail "tag name should start with 'v'"
changelog=$(git diff -U0 "$changelog_file" | grep '^[+][^+]' | sed 's/^[+]//;s/^###\s*//')
[ -z "$changelog" ] && bail "$changelog_file is not updated"
sed "s/^version = \".*\" $version_suffix$/version = \"${1#v}\" $version_suffix/g" \
-i -- */Cargo.toml
gawk -i inplace \
-v date="\"$(date +%Y-%m-%d)\"" \
'/\.TH\s.*+"8".*"System Administration"/{ $4 = date } 1' man*/*
git add -A
git commit -m "$commit_prefix$1"
git show
git -c user.name="$tagger_name" \
-c user.email="$tagger_email" \
-c user.signingkey="$signing_key" \
tag -s -a "$1" -m "$tag_prefix$1" -m "$changelog"
git tag -v "$1"

View File

@ -1,6 +1,6 @@
[package]
name = "systeroid-core"
version = "0.1.0"
version = "0.1.0" # managed by release.sh
description = "Core library of systeroid"
authors = ["Orhun Parmaksız <orhunparmaksiz@gmail.com>"]
license = "MIT OR Apache-2.0"

View File

@ -1,6 +1,6 @@
[package]
name = "systeroid-tui"
version = "0.1.0"
version = "0.1.0" # managed by release.sh
description = "A terminal user interface for managing kernel parameters"
authors = ["Orhun Parmaksız <orhunparmaksiz@gmail.com>"]
license = "MIT OR Apache-2.0"
@ -26,7 +26,7 @@ copypasta-ext = { version = "0.3.7", optional = true }
colorsys = "0.6.5"
[dependencies.systeroid-core]
version = "0.1.0"
version = "0.1.0" # managed by release.sh
path = "../systeroid-core"
[dependencies.tui]

View File

@ -1,6 +1,6 @@
[package]
name = "systeroid"
version = "0.1.0"
version = "0.1.0" # managed by release.sh
description = "A more powerful alternative to sysctl"
authors = ["Orhun Parmaksız <orhunparmaksiz@gmail.com>"]
license = "MIT OR Apache-2.0"
@ -21,5 +21,5 @@ live-tests = []
getopts = "0.2.21"
[dependencies.systeroid-core]
version = "0.1.0"
version = "0.1.0" # managed by release.sh
path = "../systeroid-core"