From 39d19c999b49ebfa78d4957cbd8f83aaa3c533e7 Mon Sep 17 00:00:00 2001 From: bburns632 Date: Tue, 1 Sep 2026 22:20:42 -0500 Subject: [PATCH] Fix broken shell/output plumbing in gallery_build workflow - write latestVersion to $GITHUB_OUTPUT so the DESCRIPTION rewrite, artifact name, and commit message resolve to the actual version instead of an empty string - use BSD-compatible tail -n 1 and sed -i '' -E, since the job runs on macos-latest - replace the nonexistent steps.previoustag reference with latesttag Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/gallery_build.yml | 11 ++++++----- CLAUDE.md | 10 +++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/gallery_build.yml b/.github/workflows/gallery_build.yml index 644831a..c23e382 100644 --- a/.github/workflows/gallery_build.yml +++ b/.github/workflows/gallery_build.yml @@ -21,12 +21,13 @@ jobs: run: | latestVersion=$(git -c 'versionsort.suffix=-' \ ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/uptake/pkgnet 'v*.*.*' \ - | tail --lines=1 \ + | tail -n 1 \ | awk -F/ '{ print $3 }' \ - | sed s/v//) + | sed 's/v//') echo "Found $latestVersion" + echo "latestVersion=$latestVersion" >> "$GITHUB_OUTPUT" - name: Update Version in local DESCRIPTION file - run: sed -i -E "s/Version:.+$/Version:\s$latestVersion/" $GITHUB_WORKSPACE/DESCRIPTION + run: sed -i '' -E "s/^Version:.+$/Version: ${{steps.latesttag.outputs.latestVersion}}/" $GITHUB_WORKSPACE/DESCRIPTION - name: Git Checkout New Docs Branch run: | git checkout -b website_docs_update @@ -51,5 +52,5 @@ jobs: - name: Commit website doc changes (overwrite if existing) run: | git add DESCRIPTION docs/\* - git commit -m "Update gallery documentation to ${{steps.previoustag.outputs.tag}}" || echo "No changes to commit" - git push -f origin website_docs_update \ No newline at end of file + git commit -m "Update gallery documentation to ${{steps.latesttag.outputs.latestVersion}}" || echo "No changes to commit" + git push -f origin website_docs_update diff --git a/CLAUDE.md b/CLAUDE.md index 7b0f659..84ce383 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -66,8 +66,8 @@ elsewhere are also accepted). `.github/workflows/gallery_build.yml` runs on push to `main` and on manual dispatch. It bumps `DESCRIPTION`'s version to the latest pkgnet tag, builds the gallery, uploads `docs/` as an artifact, and force-pushes the result to a `website_docs_update` branch for review by PR — it never -commits to `main` directly. Two existing quirks to be aware of if you touch it: `latestVersion` is a -plain shell variable that is never written to `$GITHUB_OUTPUT`, so -`steps.latesttag.outputs.latestVersion` (and `steps.previoustag.outputs.tag` in the commit message) -resolve to empty, and the version-lookup step uses GNU `tail --lines=1`/`sed -i -E` while the job -runs on `macos-latest`. +commits to `main` directly. The version-lookup step writes `latestVersion` to `$GITHUB_OUTPUT`, and +every downstream reference (the DESCRIPTION rewrite, the artifact name, the commit message) reads +`steps.latesttag.outputs.latestVersion` — a plain shell variable would not survive across steps. +Because the job runs on `macos-latest`, the shell in that step must stay BSD-compatible: `tail -n 1`, +not `tail --lines=1`, and `sed -i '' -E`, not `sed -i -E`.