diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..357eac8 --- /dev/null +++ b/RELEASE.md @@ -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. diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..1efa53a --- /dev/null +++ b/scripts/release.sh @@ -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 \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" diff --git a/systeroid-core/Cargo.toml b/systeroid-core/Cargo.toml index 64fbf3a..044ac0d 100644 --- a/systeroid-core/Cargo.toml +++ b/systeroid-core/Cargo.toml @@ -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 "] license = "MIT OR Apache-2.0" diff --git a/systeroid-tui/Cargo.toml b/systeroid-tui/Cargo.toml index 1d83303..8345c93 100644 --- a/systeroid-tui/Cargo.toml +++ b/systeroid-tui/Cargo.toml @@ -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 "] 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] diff --git a/systeroid/Cargo.toml b/systeroid/Cargo.toml index ddb22ba..62f6762 100644 --- a/systeroid/Cargo.toml +++ b/systeroid/Cargo.toml @@ -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 "] 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"