From 483ef2fecfade625fcce5e4181e53d1a7d1bd51e Mon Sep 17 00:00:00 2001 From: mr-forust Date: Sun, 5 Jul 2026 02:20:20 +0200 Subject: [PATCH] fix: publish valid release assets --- .gitea/workflows/release.yaml | 5 +++-- AGENTS.md | 9 +++++---- README.md | 9 ++++----- RELEASING.md | 14 +++++++------- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 5bff030..1fc9a63 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -58,7 +58,8 @@ jobs: mkdir -p dist binary="gosleep-timer-${version}-linux-amd64" cp target/release/gosleep-timer "dist/${binary}" - sha256sum "dist/${binary}" > "dist/${binary}.sha256" + cd dist + sha256sum "${binary}" > "${binary}.sha256" - name: Create Gitea release id: release @@ -100,7 +101,7 @@ jobs: run: | release_url="https://gitea.forust.xyz/api/v1/repos/forust/gosleep/releases" release_id="${{ steps.release.outputs.release_id }}" - for asset in dist/gosleep-timer-* dist/gosleep-timer-*.sha256; do + for asset in dist/gosleep-timer-*; do name="$(basename "$asset")" release="$(curl -fsS \ "${release_url}/${release_id}" \ diff --git a/AGENTS.md b/AGENTS.md index 8530e72..49e31db 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -73,20 +73,21 @@ test "$(cat VERSION)" = "$(cargo metadata --no-deps --format-version 1 | jq -r ' Release workflow is tag-based: ```bash -git tag -a v1.1.1 -m "gosleep-timer v1.1.1" +git tag -a vMAJOR.MINOR.PATCH -m "gosleep-timer vMAJOR.MINOR.PATCH" git push origin main -git push origin v1.1.1 +git push origin vMAJOR.MINOR.PATCH ``` The Gitea release workflow: +- runs formatting, tests, clippy, and YAML lint before building - builds `target/release/gosleep-timer` -- creates `gosleep-timer--linux-amd64.tar.gz` +- copies `gosleep-timer--linux-amd64` - writes a `.sha256` - creates or reuses the matching Gitea release - replaces release assets with matching names -The workflow uses the built-in `GITEA_TOKEN` and declares `permissions: contents: write`. +The workflow exposes `${{ secrets.GITEA_TOKEN }}` as `GITEA_TOKEN` and declares `permissions: contents: write`. ## Git Remote diff --git a/README.md b/README.md index d61226e..21bbc9d 100644 --- a/README.md +++ b/README.md @@ -33,11 +33,11 @@ install -Dm755 target/release/gosleep-timer ~/.local/bin/gosleep-timer ### From release artifact -Download `gosleep-timer--linux-amd64.tar.gz` from the Gitea release page, then: +Download `gosleep-timer--linux-amd64` and its `.sha256` from the Gitea release page, then: ```bash -tar -xzf gosleep-timer--linux-amd64.tar.gz -install -Dm755 gosleep-timer ~/.local/bin/gosleep-timer +sha256sum -c gosleep-timer--linux-amd64.sha256 +install -Dm755 gosleep-timer--linux-amd64 ~/.local/bin/gosleep-timer ``` ## Usage @@ -197,12 +197,11 @@ Required runner tools: - Rust stable toolchain with `cargo`, `rustfmt`, and `clippy` - `curl` - `jq` -- `tar` - `sha256sum` Release authentication: -- The workflow uses Gitea Actions' built-in `GITEA_TOKEN`. +- The workflow exposes Gitea Actions' built-in `${{ secrets.GITEA_TOKEN }}` as `GITEA_TOKEN`. - The workflow declares `permissions: contents: write` so the token can create releases and upload assets. See [RELEASING.md](RELEASING.md) for the full release checklist. diff --git a/RELEASING.md b/RELEASING.md index 8cb93f0..51e47b2 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -36,7 +36,6 @@ https://gitea.forust.xyz/forust/gosleep.git - `clippy` - `curl` - `jq` - - `tar` - `sha256sum` - Docker, if using the YAML lint job as written 4. Confirm Actions job token permissions allow `contents: write`. @@ -44,10 +43,10 @@ https://gitea.forust.xyz/forust/gosleep.git ## Version Bump Checklist -For a patch bump, for example `1.1.1` to `1.1.2`: +For a patch bump, for example `1.1.3` to `1.1.4`: ```bash -version=1.1.2 +version=1.1.4 ``` Update: @@ -70,10 +69,10 @@ cargo build --release --locked ```bash git status --short -git commit -am "chore: release v1.1.2" -git tag -a v1.1.2 -m "gosleep-timer v1.1.2" +git commit -am "chore: release v${version}" +git tag -a "v${version}" -m "gosleep-timer v${version}" git push origin main -git push origin v1.1.2 +git push origin "v${version}" ``` The `.gitea/workflows/release.yaml` workflow will: @@ -98,5 +97,6 @@ cargo build --release --locked mkdir -p dist binary="gosleep-timer-${version}-linux-amd64" cp target/release/gosleep-timer "dist/${binary}" -sha256sum "dist/${binary}" > "dist/${binary}.sha256" +cd dist +sha256sum "${binary}" > "${binary}.sha256" ```