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
12 changes: 8 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ jobs:
TAG: ${{ env.RELEASE_TAG }}
run: |
set -euo pipefail
latest=$(gh release view --json tagName --jq .tagName)
if [ "${TAG}" != "${latest}" ]; then
echo "tag ${TAG} is not the latest GitHub Release (${latest}); skip packaging pin"
git fetch --tags origin
newest=$(git tag --list 'v*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
if [ "${TAG}" != "${newest}" ]; then
echo "tag ${TAG} is not the newest stable tag (${newest}); skip packaging pin"
exit 0
fi
branch="chore/packaging-${TAG}"
Expand All @@ -156,7 +157,10 @@ jobs:
exit 0
fi
git commit -m "chore: pin Homebrew, Scoop, and winget to ${TAG}"
git push -u origin "${branch}" --force
if ! git push -u origin "${branch}" --force; then
echo "::warning::could not push packaging branch (PACKAGING_BUMP_TOKEN push denied); release is published"
exit 0
fi
pr=$(gh pr list --head "${branch}" --json number --jq '.[0].number')
if [ -z "${pr}" ] || [ "${pr}" = "null" ]; then
gh pr create --base main --head "${branch}" \
Expand Down
7 changes: 5 additions & 2 deletions internal/version/packaging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,11 @@ func TestReleaseWorkflowOpensOnePackagingPR(t *testing.T) {
if !strings.Contains(s, "auto-merge not enabled") && !strings.Contains(s, "::warning::") {
t.Error("packaging-bump must warn, not fail, when auto-merge is unavailable")
}
if !strings.Contains(s, "releases/latest") && !strings.Contains(s, "not the latest") {
t.Error("packaging-bump must skip when the tag is not the latest GitHub Release")
if !strings.Contains(s, "sort=-v:refname") {
t.Error("packaging-bump must compare semver tags, not GitHub latest (newest-created)")
}
if !strings.Contains(s, "could not push packaging") && !strings.Contains(s, "push denied") {
t.Error("packaging-bump must warn, not fail the release, if the bump token cannot push")
}
}

Expand Down