Skip to content

Commit 6727e16

Browse files
committed
release: fix bump sed pattern + push specific tag only
- bump: sed was anchored on ^var version; silently no-oped after the var(...) block refactor. New pattern matches both forms and now errors loudly if nothing changed, catching future layout drift. - release: git push --tags sweeps stale local tags (v0.3.1 pushed alongside v0.3.6 today, triggering a broken old workflow) and can non-FF on moving tags like 'latest', aborting the bump step. Push only origin v$(VERSION).
1 parent 8f9cb00 commit 6727e16

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ _dev-local-build:
5151

5252
bump:
5353
@if [ -z "$(VERSION)" ]; then echo "Usage: make bump VERSION=x.y.z"; exit 2; fi
54-
sed -i "s/^var version = \".*\"/var version = \"$(VERSION)\"/" cmd/scrapfly/root.go
54+
@# Match both top-level `var version = "..."` and indented `version = "..."`
55+
@# inside a `var ( ... )` block. The previous `^var version` anchor silently
56+
@# stopped matching after the var block was introduced in 583b4cf.
57+
sed -i -E 's/^([[:space:]]*(var )?version[[:space:]]*=[[:space:]]*")[^"]*(")/\1$(VERSION)\3/' cmd/scrapfly/root.go
58+
@# Fail loudly if the edit didn't actually change the file — catches future
59+
@# refactors of root.go that break the pattern again.
60+
git diff --quiet cmd/scrapfly/root.go && { echo "bump: sed did not update version; check root.go layout"; exit 1; } || true
5561
git add cmd/scrapfly/root.go
5662
git commit -m "bump version to $(VERSION)"
5763
git push
@@ -76,7 +82,10 @@ release:
7682
-git commit -m "Update API reference for version $(VERSION)"
7783
-git push origin main
7884
git tag -a v$(VERSION) -m "Version $(VERSION)"
79-
git push --tags
85+
@# Push ONLY the new tag, not `--tags`. The previous form pushed every stale
86+
@# local tag (e.g. dangling v0.3.1) and triggered old, broken workflows; it
87+
@# also failed non-FF on the moving `latest` tag, aborting the bump step.
88+
git push origin v$(VERSION)
8089
@if [ -n "$(NEXT_VERSION)" ]; then $(MAKE) bump VERSION=$(NEXT_VERSION); fi
8190

8291
fmt:

0 commit comments

Comments
 (0)