diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 3e4f168..9fd709b 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -185,23 +185,27 @@ jobs: echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT" echo "pushed ${{ steps.version.outputs.ref }}:${{ steps.version.outputs.version }} @ ${DIGEST}" - # TEMP diagnostics for the missing release notes. - - name: TEMP workspace probe + # Read the release notes before anything else touches the workspace. + # + # Deliberately not `[ -f ... ]`. Under act_runner that test reported a file + # which plainly exists in the same directory as missing, and the v0.1.3 + # release went out with a placeholder body because of it. Catting the file + # and checking whether it produced anything tests the same question + # against the operation actually needed, and cannot disagree with itself. + - name: Collect release notes + if: github.ref_type == 'tag' run: | - set -u - echo "pwd: $(pwd)" - echo "--- top level ---" - ls -la | head -30 - echo "--- docs ---" - ls -la docs 2>&1 || echo "no docs/" - echo "--- docs/releases ---" - ls -la docs/releases 2>&1 || echo "no docs/releases/" - echo "--- git ---" - git rev-parse HEAD - git ls-files docs | head - echo "--- direct test ---" - test -f docs/releases/0.1.3.md && echo "TEST -f PASSES" || echo "TEST -f FAILS" - cat docs/releases/0.1.3.md 2>&1 | head -3 + set -eu + VERSION=$(grep -m1 '^version' Cargo.toml | sed 's/.*"\(.*\)".*/\1/') + NOTES=$(cat "docs/releases/${VERSION}.md" 2>/dev/null || true) + if [ -n "$NOTES" ]; then + echo "notes: docs/releases/${VERSION}.md (${#NOTES} bytes)" + else + NOTES=$(printf 'Release %s.\n\nSee the repository README for deployment instructions.' "$VERSION") + echo "::warning::docs/releases/${VERSION}.md is missing or empty; using a placeholder" + fi + printf '%s' "$NOTES" > /tmp/notes.md + echo "collected ${#NOTES} bytes of release notes" # Releases are created only for tags. A main-branch rebuild ships the same # version again and must not rewrite the notes of an existing release. @@ -217,25 +221,13 @@ jobs: API="https://${REGISTRY}/api/v1" TAG="${{ github.ref_name }}" - # Read the version from the checked-out commit rather than from a - # previous step's output. The tag points at this commit, so the two - # agree by construction, and this avoids the release quietly falling - # back to generic notes if the output ever arrives empty. + # The tag points at this commit, so reading the version here agrees + # with the tag by construction — no dependency on an earlier step's + # output surviving intact. VERSION=$(grep -m1 '^version' Cargo.toml | sed 's/.*"\(.*\)".*/\1/') echo "publishing release for ${VERSION} (tag ${TAG})" - # Hand-written notes when they exist, because the interesting part of - # a release here is what the operator has to do, not which commits - # landed. Falls back to a short factual note, and says which it used. - if [ -f "docs/releases/${VERSION}.md" ]; then - NOTES=$(cat "docs/releases/${VERSION}.md") - echo "using docs/releases/${VERSION}.md (${#NOTES} bytes)" - else - NOTES=$(printf 'Release %s.\n\nSee the repository README for deployment instructions.' "$VERSION") - echo "::warning::docs/releases/${VERSION}.md is missing; writing a placeholder" - fi - - VERSION="$VERSION" NOTES="$NOTES" node -e ' + VERSION="$VERSION" NOTES="$(cat /tmp/notes.md)" node -e ' const { NOTES, VERSION, IMAGE, DIGEST, REGISTRY } = process.env; const ref = REGISTRY + "/" + IMAGE + ":" + VERSION; require("fs").writeFileSync("/tmp/release.json", JSON.stringify({