Skip to content

Commit 5b0fbe8

Browse files
committed
fix(ci): add contents:write permission for release uploads
Fix HTTP 403 error when uploading binaries to GitHub releases. Also update Makefile to match cem pattern: make release v0.0.1
1 parent e969ab1 commit 5b0fbe8

2 files changed

Lines changed: 20 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
types:
66
- published
77

8+
permissions:
9+
contents: write
10+
811
jobs:
912
build:
1013
uses: bennypowers/go-release-workflows/.github/workflows/build-binaries.yml@main

Makefile

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
.PHONY: all test lint clean install release
1+
.PHONY: all test lint clean install release patch minor major
22
.PHONY: linux-x64 linux-arm64 darwin-x64 darwin-arm64 win32-x64 win32-arm64
33

44
BINARY_NAME := asimonim
55
DIST_DIR := dist/bin
66
GO_BUILD_FLAGS := -ldflags="$(shell scripts/ldflags.sh)"
77

8+
# Extract version from goals if present (e.g., "make release v0.1.0" or "make release patch")
9+
VERSION ?= $(filter v% patch minor major,$(MAKECMDGOALS))
10+
811
# Workaround for Gentoo Linux "hole in findfunctab" error with race detector
912
# See: https://bugs.gentoo.org/961618
1013
ifeq ($(shell test -f /etc/gentoo-release && echo yes),yes)
@@ -33,15 +36,23 @@ lint:
3336
release:
3437
@if [ -z "$(VERSION)" ]; then \
3538
echo "Error: VERSION or bump type is required"; \
36-
echo "Usage: make release VERSION=<version|patch|minor|major>"; \
37-
echo " make release VERSION=v0.1.0 - Release explicit version"; \
38-
echo " make release VERSION=patch - Bump patch version (0.0.x)"; \
39-
echo " make release VERSION=minor - Bump minor version (0.x.0)"; \
40-
echo " make release VERSION=major - Bump major version (x.0.0)"; \
39+
echo "Usage: make release <version|patch|minor|major>"; \
40+
echo " make release v0.1.0 - Release explicit version"; \
41+
echo " make release patch - Bump patch version (0.0.x)"; \
42+
echo " make release minor - Bump minor version (0.x.0)"; \
43+
echo " make release major - Bump major version (x.0.0)"; \
4144
exit 1; \
4245
fi
4346
@./scripts/release.sh $(VERSION)
4447

48+
# Prevent make from treating version args as file targets
49+
patch minor major:
50+
@:
51+
52+
# Catch version tags like v0.1.0
53+
v%:
54+
@:
55+
4556
# Cross-compilation targets (CGO_ENABLED=0 for pure Go)
4657
linux-x64:
4758
@mkdir -p $(DIST_DIR)

0 commit comments

Comments
 (0)