chore(justfile): A new recipe to release n34
Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
26
justfile
26
justfile
@@ -8,13 +8,14 @@
|
|||||||
set quiet
|
set quiet
|
||||||
set unstable
|
set unstable
|
||||||
set shell := ["/usr/bin/env", "bash", "-c"]
|
set shell := ["/usr/bin/env", "bash", "-c"]
|
||||||
set script-interpreter := ["/usr/bin/env", "bash", "-c"]
|
set script-interpreter := ["/usr/bin/env", "bash"]
|
||||||
|
|
||||||
JUST_EXECUTABLE := "just -u -f " + justfile()
|
JUST_EXECUTABLE := "just -u -f " + justfile()
|
||||||
header := "Available tasks:\n"
|
header := "Available tasks:\n"
|
||||||
# Get the MSRV from the Cargo.toml
|
# Get the MSRV from the Cargo.toml
|
||||||
msrv := `cat Cargo.toml | grep "rust-version" | sed 's/.*"\(.*\)".*/\1/'`
|
msrv := `cat Cargo.toml | grep "rust-version" | sed 's/.*"\(.*\)".*/\1/'`
|
||||||
|
|
||||||
|
export TZ := "UTC"
|
||||||
|
|
||||||
_default:
|
_default:
|
||||||
@{{JUST_EXECUTABLE}} --list-heading "{{header}}" --list
|
@{{JUST_EXECUTABLE}} --list-heading "{{header}}" --list
|
||||||
@@ -25,8 +26,10 @@ ci: && msrv _done_ci
|
|||||||
cargo build -q
|
cargo build -q
|
||||||
echo "🔍 Checking code formatting..."
|
echo "🔍 Checking code formatting..."
|
||||||
cargo fmt -q -- --check
|
cargo fmt -q -- --check
|
||||||
|
taplo fmt --check --config ./.taplo.toml
|
||||||
echo "🧹 Running linter checks..."
|
echo "🧹 Running linter checks..."
|
||||||
cargo clippy -q -- -D warnings
|
cargo clippy -q -- -D warnings
|
||||||
|
taplo check --config ./.taplo.toml
|
||||||
|
|
||||||
# Check that the current MSRV is correct
|
# Check that the current MSRV is correct
|
||||||
msrv:
|
msrv:
|
||||||
@@ -39,16 +42,29 @@ _done_ci:
|
|||||||
|
|
||||||
# Update the changelog
|
# Update the changelog
|
||||||
[script]
|
[script]
|
||||||
change-log:
|
changelog:
|
||||||
OLD_HASH=$(sha256sum CHANGELOG.md | head -c 64)
|
OLD_HASH=$(sha256sum CHANGELOG.md | head -c 64)
|
||||||
git-cliff > CHANGELOG.md
|
git-cliff > CHANGELOG.md
|
||||||
NEW_HASH=$(sha256sum CHANGELOG.md | head -c 64)
|
NEW_HASH=$(sha256sum CHANGELOG.md | head -c 64)
|
||||||
if [[ $OLD_HASH != $NEW_HASH ]]; then
|
if [[ $OLD_HASH != $NEW_HASH ]]; then
|
||||||
TZ=UTC git add CHANGELOG.md
|
git add CHANGELOG.md
|
||||||
TZ=UTC git commit -m 'chore(changelog): Update the changelog'
|
git commit -m 'chore(changelog): Update the changelog'
|
||||||
echo 'The changes have been added to the changelog file and committed'
|
echo 'The changes have been added to the changelog file and committed'
|
||||||
else
|
else
|
||||||
echo 'No changes have been added to the changelog'
|
echo 'No changes have been added to the changelog'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias cl := change-log
|
# Releases a new version of n34. Requires a clean file tree with no uncommitted changes.
|
||||||
|
[script]
|
||||||
|
release version:
|
||||||
|
set -e
|
||||||
|
TAG_MSG=$(git-cliff --strip all --unreleased --tag "v{{ version }}" | sed -e 's/[]#[]//g' -e 's/^ //g')
|
||||||
|
sed -i "s/^version\s*= \".*\"/version = \"{{ version }}\"/" ./Cargo.toml
|
||||||
|
taplo fmt --config ./.taplo.toml ./Cargo.toml
|
||||||
|
{{ JUST_EXECUTABLE }} ci
|
||||||
|
git-cliff -t "v{{ version }}" > CHANGELOG.md
|
||||||
|
git add .
|
||||||
|
git commit -m 'chore: Bump the version to `v{{ version }}`'
|
||||||
|
git tag -s -m "$TAG_MSG" "v{{ version }}"
|
||||||
|
git push origin master --tags
|
||||||
|
cargo publish
|
||||||
|
|||||||
Reference in New Issue
Block a user