mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
CHANGELOG-big.md is the changelog as it was: # Status, # Upcoming and every release in full, with its <details> entries. Everything that writes or edits the changelog uses it - release-all.sh, release-notes.sh and the release workflow, the commit-link repair in build.sh and fix-changelog-hashes.sh, the archive, the wrapper, the version scripts - and the release notes' "More details at ChangeLog" link goes to its section. remote-release.py, shared with FerretDB and the patch repositories, takes the file from its config, and only WeKan's names CHANGELOG-big.md. CHANGELOG.md is new: no Status and no Upcoming, only the In short paragraph of each of the five newest releases and a link to its full section, in plain Markdown - no <details>, <summary>, </summary> or </details>, and HTML links written as Markdown links. releases/changelog-short.mjs writes it; release-all.sh runs it right after naming the release, so it is in the release commit, and changelog.sh does too. The Sandstorm App Market keeps embedding CHANGELOG.md, now the short one. old-CHANGELOG/'s headers say they moved out of CHANGELOG-big.md. References to Upcoming or TODO Later in code comments and docs name CHANGELOG-big.md. CLAUDE.md and AGENTS.md describe both files: CHANGELOG-big.md is written, CHANGELOG.md is generated and never edited by hand. tests/changelogShort.test.cjs: CHANGELOG.md is exactly what the generator writes, the five newest releases with their whole In short, links that resolve, and none of the four tags or an HTML link; the changelog tests read CHANGELOG-big.md. Thanks to xet7 !
64 lines
2.7 KiB
Bash
Executable File
64 lines
2.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Make sure the GitHub Release for a tag exists, creating it with the notes of
|
|
# this version's CHANGELOG-big.md section when it does not.
|
|
#
|
|
# Usage: releases/ensure-github-release.sh <repository> <version>
|
|
#
|
|
# WHY A BUILD JOB CREATES THE RELEASE. release-all.yml attaches every file to
|
|
# the release from the job that BUILT it, as that job's last step - a file goes
|
|
# up the moment it exists, not when the slowest build of the run is done, and a
|
|
# cancelled run still leaves every finished file on the release. The first
|
|
# file of a run is the amd64 bundle, and nothing can be attached to a release
|
|
# that does not exist yet, so build-amd64 (and build-arm64, in case it is
|
|
# re-run on its own) call this right before attaching. The `release` job later
|
|
# refreshes the same notes and checks both base bundles are there; it no longer
|
|
# uploads anything.
|
|
#
|
|
# Creating it HERE, and not in an earlier job of its own, keeps one property
|
|
# the release flow depends on: a run whose amd64 build fails publishes NO
|
|
# release at all, so CLAUDE.md's "nothing published -> rename the section back
|
|
# to Upcoming and run again" still applies to it.
|
|
#
|
|
# The notes go file to file, never through a shell variable or argv: see
|
|
# releases/release-notes.sh for the two ways that broke a release.
|
|
set -euo pipefail
|
|
. "$(dirname "${BASH_SOURCE[0]}")/tools-env.sh" # temporary files and downloads go to .tools/tmp
|
|
if [ "$#" -ne 2 ]; then
|
|
echo "Usage: $0 <repository> <version>" >&2
|
|
exit 2
|
|
fi
|
|
repository=$1
|
|
version=${2#v}
|
|
tag="v${version}"
|
|
repo_root=$(cd "$(dirname "$0")/.." && pwd)
|
|
export TMPDIR="${TMPDIR:-$repo_root/.tools/tmp}"
|
|
mkdir -p "$TMPDIR"
|
|
|
|
if gh release view --repo "$repository" "$tag" --json tagName >/dev/null 2>&1; then
|
|
echo "OK: release $tag already exists."
|
|
exit 0
|
|
fi
|
|
|
|
notes=$(mktemp "$TMPDIR/release-notes.XXXXXX")
|
|
trap 'rm -f "$notes"' EXIT
|
|
bash "$repo_root/releases/release-notes.sh" "$version" "$repo_root/CHANGELOG-big.md" > "$notes"
|
|
|
|
for attempt in 1 2 3; do
|
|
if gh release create --repo "$repository" "$tag" --verify-tag \
|
|
--title "$tag" --notes-file "$notes"; then
|
|
echo "OK: created release $tag."
|
|
exit 0
|
|
fi
|
|
# Another job may have created it between the view above and this create.
|
|
if gh release view --repo "$repository" "$tag" --json tagName >/dev/null 2>&1; then
|
|
echo "OK: release $tag exists (created by another job)."
|
|
exit 0
|
|
fi
|
|
if [ "$attempt" -lt 3 ]; then
|
|
echo "::warning::Could not create release $tag; retrying in $((attempt * 10))s."
|
|
sleep $((attempt * 10))
|
|
fi
|
|
done
|
|
echo "::error::Could not create release $tag. The tag must exist (the prepare job pushes it), and GITHUB_TOKEN must be allowed to write releases here (permissions: contents: write)." >&2
|
|
exit 1
|