Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- `scripts/verify-tag-currency.sh` is now package-tools' current script: a tag behind `main` only by `.github/`-only commits (a Dependabot bump) passes, and a released package is told to cut a patch rather than move a published tag.
- `laravel/framework ^13.0` is now declared in `require`. `src/` uses `Vite` from `Illuminate\Foundation`, which no `illuminate/*` component ships, so the dependency only arrived through the host application.
- The package renders through `laranail/confetti::` (`ConfettiTags::VIEW`).
`laranail-confetti::` still resolves the same files.
Expand Down
30 changes: 29 additions & 1 deletion scripts/verify-tag-currency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@ tag_commit() {
fi
}

# A commit that touches only .github/ ships nothing (the directory is export-ignored), so it is not
# unreleased code: a tag behind main by such commits still hands consumers exactly what main would.
# Dependabot adds one weekly, so without this every package's scheduled check would go red on a
# workflow bump. That holds for both tag models.
#
# When shipped code IS behind, the advice differs. A package on the moving-tag model holds exactly
# one v* tag and moves it. A package that has cut a second tag is on real releases, and a published
# release is immutable: moving it hands consumers who already resolved it different code under the
# same name, so it gets a new patch instead. Called after ${tags} is read.
released() { [ "$(printf '%s\n' "${tags}" | grep -c .)" -gt 1 ]; }

ci_only() {
local files
files=$(gh api "repos/${REPO}/compare/$1...${head}" --jq '.files[].filename' 2>/dev/null) || return 1
[ -n "${files}" ] || return 1
! printf '%s\n' "${files}" | grep -qvE '^\.github/'
}

# Not mapfile: macOS ships bash 3.2, which does not have it, and this has to run
# on a maintainer's laptop as well as in CI.
tags=$(gh api "repos/${REPO}/git/matching-refs/tags/v" --jq '.[].ref | sub("refs/tags/"; "")' 2>/dev/null | sort -V)
Expand Down Expand Up @@ -167,7 +185,11 @@ if [ "${commit}" = "${head}" ]; then
ok "${highest} is also on ${BRANCH}."
else
hbehind=$(gh api "repos/${REPO}/compare/${hcommit}...${head}" --jq '.ahead_by' 2>/dev/null || echo '?')
if ci_only "${hcommit}"; then
ok "${highest} is behind ${BRANCH} only by ${hbehind} commit(s) that touch only .github/."
else
fail "${highest} is the highest tag and is ${hbehind} commit(s) behind ${BRANCH}. An unconstrained \`composer require ${REPO}\` resolves it, so it must be current or it must not exist."
fi
fi
fi
else
Expand All @@ -178,7 +200,13 @@ else
--jq '.commits[] | " " + .sha[0:8] + " " + (.commit.message | split("\n")[0])' 2>/dev/null || true
echo

fail "${current} is behind ${BRANCH}. Move it (git tag -f ${current} ${BRANCH} && git push --force origin ${current}) or cut a new one."
if ci_only "${commit}"; then
ok "${current} is behind ${BRANCH} only by commits that touch only .github/, so nothing a consumer installs is unreleased."
elif released; then
fail "${current} is behind ${BRANCH}. It is a published release, so do not move it: cut ${current%.*}.$(( ${current##*.} + 1 ))."
else
fail "${current} is behind ${BRANCH}. Move it (git tag -f ${current} ${BRANCH} && git push --force origin ${current}) or cut a new one."
fi
fi

exit "${FAILED}"
Loading