From 758ff81e9f6e5347c7cc0600d7e95d7de6e4e779 Mon Sep 17 00:00:00 2001 From: nicodes Date: Tue, 27 Oct 2026 20:04:07 +0100 Subject: [PATCH 1/2] Use shared tools CLI binary release automation --- .github/workflows/release.yml | 28 ++++++++++++++++++++++++++++ komizo.json | 3 ++- komizo.lock | 2 +- scripts/build.sh | 9 ++++++++- scripts/check-artifacts.py | 6 +++--- 5 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2c78ed1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +name: Release +'on': + workflow_dispatch: + inputs: + bump: + description: Version bump + required: true + type: choice + default: patch + options: + - patch + - minor + - major +permissions: {} +concurrency: release-${{ github.repository }} +jobs: + release: + name: Release + uses: nicodes/tools/.github/workflows/cli-release.yml@0276991861118d6e70a92cd11432dd664d3b030f + permissions: + contents: write + attestations: write + id-token: write + with: + tools-ref: '0276991861118d6e70a92cd11432dd664d3b030f' + bump: ${{ inputs.bump }} + binary: spritesmith + prepared-assets: dist diff --git a/komizo.json b/komizo.json index e5fcd99..200cf08 100644 --- a/komizo.json +++ b/komizo.json @@ -78,7 +78,8 @@ "workflow": { "required": [ "ci.yml", - "dependency-policy.yml" + "dependency-policy.yml", + "release.yml" ], "ci_gates": [ "Test" diff --git a/komizo.lock b/komizo.lock index 9f66f24..4205cda 100644 --- a/komizo.lock +++ b/komizo.lock @@ -2,7 +2,7 @@ "version": 1, "platform": "0.2.4", "platform_revision": "40086036977a5fc0119d6c4c1d5eb6ae3ab3b4b9", - "manifest_sha256": "653c90b64c1e3ab61144487592183467b11f89192d79669ad16a0117997badd1", + "manifest_sha256": "923459892302e4bfad0c8d55fbe18dd969504460eecf118a97a2949d9e3983e4", "runtime_sha256": "000c1991c455b7e1269646e40c05ebf4a1b0717197c34838d2b7669430b3e862", "recipe_sha256": "54409e9d09752cdb8031115189632766982b31684cf9acab607b297461b93156" } diff --git a/scripts/build.sh b/scripts/build.sh index c74db17..1cdfee5 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -14,7 +14,14 @@ for target in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; d CGO_ENABLED=0 GOOS="$target_os" GOARCH="$target_arch" go build -trimpath \ -ldflags "-X main.version=$VERSION -X main.revision=$revision" -o "$staging/$binary" ./cmd/spritesmith cp README.md "$staging/README.md" - archive="spritesmith_${target_os}_${target_arch}" + case "$target_os" in + linux) os_label=Linux ;; + darwin) os_label=Darwin ;; + windows) os_label=Windows ;; + esac + arch_label="$target_arch" + [[ "$target_arch" != amd64 ]] || arch_label=x86_64 + archive="spritesmith_${os_label}_${arch_label}" if [[ "$target_os" == windows ]]; then python3 - "$staging" "dist/$archive.zip" <<'PY' from pathlib import Path diff --git a/scripts/check-artifacts.py b/scripts/check-artifacts.py index fb37205..e18080a 100644 --- a/scripts/check-artifacts.py +++ b/scripts/check-artifacts.py @@ -10,8 +10,8 @@ root = Path('dist') expected = {f'spritesmith_{os}_{arch}.{suffix}' for os, arch, suffix in ( - ('linux', 'amd64', 'tar.gz'), ('linux', 'arm64', 'tar.gz'), - ('darwin', 'amd64', 'tar.gz'), ('darwin', 'arm64', 'tar.gz'), ('windows', 'amd64', 'zip'))} + ('Linux', 'x86_64', 'tar.gz'), ('Linux', 'arm64', 'tar.gz'), + ('Darwin', 'x86_64', 'tar.gz'), ('Darwin', 'arm64', 'tar.gz'), ('Windows', 'x86_64', 'zip'))} checksums = {} for line in (root/'checksums.txt').read_text().splitlines(): digest, name = line.split() @@ -35,7 +35,7 @@ release = json.loads((root/'release.json').read_text()) if release['revision'] != revision: raise SystemExit('artifacts belong to another source revision') with tempfile.TemporaryDirectory() as temp: - with tarfile.open(root/'spritesmith_linux_amd64.tar.gz') as archive: + with tarfile.open(root/'spritesmith_Linux_x86_64.tar.gz') as archive: archive.extractall(temp, filter='data') output = subprocess.check_output([str(Path(temp)/'spritesmith'), '--version'], text=True) if revision not in output: raise SystemExit('binary revision differs') From 4aa28463131423cc0d0ae668779da65e77b0d0f8 Mon Sep 17 00:00:00 2001 From: nicodes Date: Tue, 27 Oct 2026 20:05:39 +0100 Subject: [PATCH 2/2] Exclude generated release payloads from source status --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 1106fe6..11d0588 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ spritesmith.png .komizo.mise*.toml .komizo.mise*.lock +/release-assets/