mirror of
https://github.com/zealdocs/zeal.git
synced 2026-08-29 08:34:50 +08:00
build(just): move release-push into a script
This commit is contained in:
@@ -98,17 +98,7 @@ release-prepare version:
|
||||
# Maintainer use only.
|
||||
[group('release')]
|
||||
release-push version remote="origin":
|
||||
git add assets/freedesktop/org.zealdocs.zeal.appdata.xml.in CMakeLists.txt
|
||||
git diff --staged --quiet || git commit -m "chore: release v{{version}}"
|
||||
# Annotated: `git describe` without `--tags` ignores lightweight tags, and
|
||||
# the AUR zeal-git package derives its version that way.
|
||||
git rev-parse -q --verify refs/tags/v{{version}} > /dev/null || git tag -a v{{version}} -m "v{{version}}"
|
||||
git push {{remote}} HEAD
|
||||
gh release create v{{version}} --draft --notes-file build/release-notes.md \
|
||||
--repo "$(git remote get-url {{remote}} | sed -E 's|^.*github\.com[:/]||; s|\.git$||')"
|
||||
git push {{remote}} v{{version}}
|
||||
@echo "Pushed v{{version}} with draft release. CI will upload artifacts."
|
||||
@echo "Approve the 'release' environment to let the Windows jobs run."
|
||||
bash tools/release-push.sh {{version}} {{remote}}
|
||||
|
||||
# Delete the draft release, the remote tag, and the local tag for a version,
|
||||
# undoing `just release-push` so it can be run again. Refuses to delete a
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# release-push.sh - Commit, tag, and push a prepared release.
|
||||
#
|
||||
# SPDX-FileCopyrightText: Oleg Shparber, et al. <https://zealdocs.org>
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
# Commits the appdata and version bump left by release-prepare.sh, pushes the
|
||||
# branch, creates the draft GitHub release from the generated notes, then tags
|
||||
# and pushes the tag, which starts the build CI. The commit and tag steps are
|
||||
# skipped if already done, so the same version can go to a fork first and then
|
||||
# be promoted to upstream.
|
||||
#
|
||||
# Usage: tools/release-push.sh <version> [remote]
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
trap 'echo "ERROR: failed at line ${LINENO}: ${BASH_COMMAND}" >&2' ERR
|
||||
|
||||
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
|
||||
echo "Usage: $0 <version> [remote]" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
VERSION="$1"
|
||||
REMOTE="${2:-origin}"
|
||||
TAG="v${VERSION}"
|
||||
|
||||
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Invalid version: '${VERSION}'. Expected major.minor.patch (e.g. 0.9.0)." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
repo=$(git remote get-url "$REMOTE" | sed -E 's|^.*github\.com[:/]||; s|\.git$||')
|
||||
|
||||
git add assets/freedesktop/org.zealdocs.zeal.appdata.xml.in CMakeLists.txt
|
||||
if git diff --staged --quiet; then
|
||||
echo "Nothing to commit; ${TAG} content is already committed."
|
||||
else
|
||||
git commit -m "chore: release ${TAG}"
|
||||
fi
|
||||
|
||||
# Annotated: `git describe` without `--tags` ignores lightweight tags, and the
|
||||
# AUR zeal-git package derives its version that way.
|
||||
if git rev-parse -q --verify "refs/tags/${TAG}" > /dev/null; then
|
||||
echo "Tag ${TAG} already exists; reusing it."
|
||||
else
|
||||
git tag -a "$TAG" -m "$TAG"
|
||||
fi
|
||||
|
||||
git push "$REMOTE" HEAD
|
||||
|
||||
# Created before the tag is pushed, so the draft is in place when CI starts.
|
||||
gh release create "$TAG" --draft --notes-file build/release-notes.md --repo "$repo"
|
||||
|
||||
git push "$REMOTE" "$TAG"
|
||||
|
||||
echo "Pushed ${TAG} to ${repo}. CI will build, upload, and publish."
|
||||
Reference in New Issue
Block a user