Something went wrong. Try again.
Local-first knowledge base made for Typst and the Atmosphere. typbase.at
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475#!/usr/bin/env bash
# Bumps every version source with scripts/release/bump-version.mjs and, unless# DRY_RUN is true, regenerates CHANGELOG.md, commits, tags, and pushes the# release tag. Writes the new version as the `version` step output.
set -euo pipefail
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)source "$script_dir/lib.sh"
require BUMPdry_run=${DRY_RUN:-false}
repo_root=$(cd "$script_dir/../.." && pwd)cd "$repo_root"
if [[ "$dry_run" == "true" ]]; then version=$(node scripts/release/bump-version.mjs "$BUMP" --dry-run)else version=$(node scripts/release/bump-version.mjs "$BUMP")fi
set_output version "$version"echo "Next version: $version"
if [[ "$dry_run" == "true" ]]; then exit 0fi
tag="typbase-v$version"
# One generated section per release from conventional commits (.cliff.toml).# Older sections are kept verbatim, so hand edits (and the first release's# curated list) survive. The intro above the first `## [` belongs to the file,# so the section is composed under it instead of using --prepend, which would# insert above the intro when the config has no header.if [[ -f CHANGELOG.md ]]; then section=$(mktemp) merged=$(mktemp) git_cliff --config .cliff.toml --unreleased --tag "$tag" --strip header -o "$section" awk '/^## \[/ { exit } { print }' CHANGELOG.md > "$merged" cat "$section" >> "$merged" awk '/^## \[/ { found = 1 } found' CHANGELOG.md >> "$merged" mv "$merged" CHANGELOG.md rm -f "$section"else git_cliff --config .cliff.toml --tag "$tag" -o CHANGELOG.mdfi
# A release can legitimately be chore-only, so this warns instead of failing.if ! awk ' /^## \[/ { sections++; next } sections == 1 && /^- / { entries = 1 } END { exit entries ? 0 : 1 }' CHANGELOG.md; then echo "warning: CHANGELOG.md has no entries for $version; the release notes will be empty" >&2fi
bash "$script_dir/git-ssh-signing.sh"
sign_commit=()sign_tag=()if [[ -n "${SSH_SIGNING_KEY:-}" ]]; then sign_commit=(-S) # `git tag` signs with -s. -S is only a `git commit` flag. sign_tag=(-s)fi
git add -Agit commit "${sign_commit[@]}" -m "chore: bump version to $version" || echo "No changes to commit"git tag "${sign_tag[@]}" -a "$tag" -m "Typbase Release v$version"git pushgit push origin "$tag"