Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 549025dfe7 | |||
| fface10081 | |||
| 2c32f5856b | |||
| 1babd404f9 | |||
| ce35617bbe | |||
| f4c54837de | |||
| 483ef2fecf | |||
| ce236bc49f | |||
| b067cf572e | |||
| af95742f69 | |||
| 0b0f0af82d | |||
| a582913269 | |||
| 911aaca355 | |||
| 189ae75a01 | |||
| c39fa10c9c | |||
| 5c9a349114 |
@@ -10,8 +10,38 @@ permissions:
|
|||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linux-amd64:
|
verify:
|
||||||
runs-on: [self-hosted, linux, arch, homelab]
|
runs-on: [self-hosted, linux, arch, homelab]
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Check formatting
|
||||||
|
shell: bash
|
||||||
|
run: cargo fmt --check
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
shell: bash
|
||||||
|
run: cargo test --locked
|
||||||
|
|
||||||
|
- name: Run clippy
|
||||||
|
shell: bash
|
||||||
|
run: cargo clippy --locked -- -D warnings
|
||||||
|
|
||||||
|
- name: Lint YAML
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
docker run --rm \
|
||||||
|
-v "$PWD:/work" \
|
||||||
|
-w /work \
|
||||||
|
cytopia/yamllint:latest \
|
||||||
|
-c .yamllint .
|
||||||
|
|
||||||
|
linux-amd64:
|
||||||
|
needs: verify
|
||||||
|
runs-on: [self-hosted, linux, arch, homelab]
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -26,16 +56,17 @@ jobs:
|
|||||||
tag="${GITHUB_REF##*/}"
|
tag="${GITHUB_REF##*/}"
|
||||||
version="${tag#v}"
|
version="${tag#v}"
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
cp target/release/gosleep-timer dist/gosleep-timer
|
binary="gosleep-timer-${version}-linux-amd64"
|
||||||
tar -C dist -czf "dist/gosleep-timer-${version}-linux-amd64.tar.gz" gosleep-timer
|
cp target/release/gosleep-timer "dist/${binary}"
|
||||||
sha256sum "dist/gosleep-timer-${version}-linux-amd64.tar.gz" > "dist/gosleep-timer-${version}-linux-amd64.tar.gz.sha256"
|
cd dist
|
||||||
|
sha256sum "${binary}" > "${binary}.sha256"
|
||||||
|
|
||||||
- name: Create Gitea release
|
- name: Create Gitea release
|
||||||
id: release
|
id: release
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
tag="${GITHUB_REF##*/}"
|
tag="${GITHUB_REF##*/}"
|
||||||
release_url="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases"
|
release_url="https://gitea.forust.xyz/api/v1/repos/forust/gosleep/releases"
|
||||||
existing="$(curl -fsS \
|
existing="$(curl -fsS \
|
||||||
"${release_url}/tags/${tag}" \
|
"${release_url}/tags/${tag}" \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" || true)"
|
-H "Authorization: token ${GITEA_TOKEN}" || true)"
|
||||||
@@ -68,20 +99,21 @@ jobs:
|
|||||||
- name: Upload Gitea release assets
|
- name: Upload Gitea release assets
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
release_url="https://gitea.forust.xyz/api/v1/repos/forust/gosleep/releases"
|
||||||
release_id="${{ steps.release.outputs.release_id }}"
|
release_id="${{ steps.release.outputs.release_id }}"
|
||||||
for asset in dist/*.tar.gz dist/*.sha256; do
|
for asset in dist/gosleep-timer-*; do
|
||||||
name="$(basename "$asset")"
|
name="$(basename "$asset")"
|
||||||
release="$(curl -fsS \
|
release="$(curl -fsS \
|
||||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${release_id}" \
|
"${release_url}/${release_id}" \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}")"
|
-H "Authorization: token ${GITEA_TOKEN}")"
|
||||||
asset_id="$(printf '%s' "$release" | jq -r --arg name "$name" '.assets[]? | select(.name == $name) | .id' | head -n 1)"
|
asset_id="$(printf '%s' "$release" | jq -r --arg name "$name" '.assets[]? | select(.name == $name) | .id' | head -n 1)"
|
||||||
if [ -n "$asset_id" ]; then
|
if [ -n "$asset_id" ]; then
|
||||||
curl -fsS \
|
curl -fsS \
|
||||||
-X DELETE "${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets/${asset_id}" \
|
-X DELETE "${release_url}/${release_id}/assets/${asset_id}" \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}"
|
-H "Authorization: token ${GITEA_TOKEN}"
|
||||||
fi
|
fi
|
||||||
curl -fsS \
|
curl -fsS \
|
||||||
-X POST "${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=${name}" \
|
-X POST "${release_url}/${release_id}/assets?name=${name}" \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
-F "attachment=@${asset}"
|
-F "attachment=@${asset}"
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -0,0 +1,146 @@
|
|||||||
|
# AGENTS.md
|
||||||
|
|
||||||
|
Instructions for coding agents working in this repository.
|
||||||
|
|
||||||
|
## Project Shape
|
||||||
|
|
||||||
|
`gosleep-timer` is a Rust-first, single-binary Linux terminal app.
|
||||||
|
|
||||||
|
- Main code: `src/main.rs`
|
||||||
|
- Package metadata: `Cargo.toml`
|
||||||
|
- Locked dependency graph: `Cargo.lock`
|
||||||
|
- Version files: `Cargo.toml`, `Cargo.lock`, `VERSION`, `CHANGELOG.md`
|
||||||
|
- CI: `.gitea/workflows/ci.yaml`
|
||||||
|
- Release workflow: `.gitea/workflows/release.yaml`
|
||||||
|
- Release docs: `RELEASING.md`
|
||||||
|
|
||||||
|
Do not reintroduce Go, Python, Node, Docker packaging, or multi-language runtime dependencies unless the user explicitly asks for that migration.
|
||||||
|
|
||||||
|
## Required Checks
|
||||||
|
|
||||||
|
Run these before committing code changes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo fmt --check
|
||||||
|
cargo test --locked
|
||||||
|
cargo clippy --locked -- -D warnings
|
||||||
|
cargo build --release --locked
|
||||||
|
```
|
||||||
|
|
||||||
|
Run YAML lint when editing workflow or YAML files:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yamllint -c .yamllint .
|
||||||
|
```
|
||||||
|
|
||||||
|
If `yamllint` is not installed, the CI-compatible fallback is:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm -v "$PWD:/work" -w /work cytopia/yamllint:latest -c .yamllint .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Local Smoke Tests
|
||||||
|
|
||||||
|
Use a temporary config path so local tests do not mutate the user's real config:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
tmpdir="$(mktemp -d)"
|
||||||
|
cargo run -- --config "$tmpdir/config.yaml" init
|
||||||
|
cargo run -- --config "$tmpdir/config.yaml" validate
|
||||||
|
cargo run -- --config "$tmpdir/config.yaml" status
|
||||||
|
cargo run -- --config "$tmpdir/config.yaml" preview
|
||||||
|
```
|
||||||
|
|
||||||
|
For `run` smoke tests, pass `--no-actions` or disable actions first so the command does not call `playerctl`, `systemctl`, `pkill`, workspace tools, or custom shell commands.
|
||||||
|
|
||||||
|
## Versioning
|
||||||
|
|
||||||
|
The project uses semantic versioning. Tags must be annotated and formatted as `vMAJOR.MINOR.PATCH`.
|
||||||
|
|
||||||
|
When bumping a version, update all of:
|
||||||
|
|
||||||
|
- `Cargo.toml`
|
||||||
|
- `Cargo.lock`
|
||||||
|
- `VERSION`
|
||||||
|
- `CHANGELOG.md`
|
||||||
|
|
||||||
|
Verify version consistency with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
test "$(cat VERSION)" = "$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Releases
|
||||||
|
|
||||||
|
Release workflow is tag-based:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git tag -a vMAJOR.MINOR.PATCH -m "gosleep-timer vMAJOR.MINOR.PATCH"
|
||||||
|
git push origin main
|
||||||
|
git push origin vMAJOR.MINOR.PATCH
|
||||||
|
```
|
||||||
|
|
||||||
|
The Gitea release workflow:
|
||||||
|
|
||||||
|
- runs formatting, tests, clippy, and YAML lint before building
|
||||||
|
- builds `target/release/gosleep-timer`
|
||||||
|
- copies `gosleep-timer-<version>-linux-amd64`
|
||||||
|
- writes a `.sha256`
|
||||||
|
- creates or reuses the matching Gitea release
|
||||||
|
- replaces release assets with matching names
|
||||||
|
|
||||||
|
The workflow exposes `${{ secrets.GITEA_TOKEN }}` as `GITEA_TOKEN` and declares `permissions: contents: write`.
|
||||||
|
|
||||||
|
## Git Remote
|
||||||
|
|
||||||
|
Expected upstream:
|
||||||
|
|
||||||
|
```text
|
||||||
|
origin ssh://git@gitssh.forust.xyz:2221/forust/gosleep.git
|
||||||
|
```
|
||||||
|
|
||||||
|
HTTPS remote URL:
|
||||||
|
|
||||||
|
```text
|
||||||
|
https://gitea.forust.xyz/forust/gosleep.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Before pushing, confirm:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git status --short --branch
|
||||||
|
git branch -vv
|
||||||
|
git remote -v
|
||||||
|
```
|
||||||
|
|
||||||
|
## Repository Hygiene
|
||||||
|
|
||||||
|
- Keep `target/`, `dist/`, `.env*`, logs, temp files, and local artifacts out of git.
|
||||||
|
- Keep `Cargo.lock` committed; this is an application, not a library.
|
||||||
|
- Prefer small, direct Rust changes in `src/main.rs` until the code genuinely needs splitting.
|
||||||
|
- Do not add broad abstractions just to prepare for hypothetical modules.
|
||||||
|
- Do not add shelling out during tests unless the test fully controls the command.
|
||||||
|
- Keep docs synchronized with actual behavior and command names.
|
||||||
|
- Keep release assets and generated archives out of the repo.
|
||||||
|
|
||||||
|
## TUI Notes
|
||||||
|
|
||||||
|
The TUI uses Ratatui and Crossterm. Be careful with terminal-size assumptions.
|
||||||
|
|
||||||
|
For layout changes, check both:
|
||||||
|
|
||||||
|
- narrow terminal behavior, where settings and preview stack vertically
|
||||||
|
- wide terminal behavior, where settings and preview are side by side
|
||||||
|
|
||||||
|
Avoid truncating command previews without a visible indication. Preview wrapping is expected behavior.
|
||||||
|
|
||||||
|
## Safety
|
||||||
|
|
||||||
|
The app can run destructive or disruptive post-countdown commands:
|
||||||
|
|
||||||
|
- `pkill`
|
||||||
|
- `systemctl poweroff`
|
||||||
|
- `systemctl reboot`
|
||||||
|
- arbitrary custom shell commands
|
||||||
|
|
||||||
|
Never run `gosleep-timer run` against the real user config during verification unless the user explicitly asks for it. Use an isolated config and disable actions for smoke tests.
|
||||||
@@ -4,6 +4,41 @@ All notable changes to this project are documented here.
|
|||||||
|
|
||||||
The project uses semantic versioning. Tags are formatted as `vMAJOR.MINOR.PATCH`.
|
The project uses semantic versioning. Tags are formatted as `vMAJOR.MINOR.PATCH`.
|
||||||
|
|
||||||
|
## [1.2.1] - 2026-07-05
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Updated the TUI running screen to center a larger termdown-style ASCII time-left display above progress and post-countdown commands.
|
||||||
|
|
||||||
|
## [1.2.0] - 2026-07-05
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added `status`, `validate`, `edit`, `history`, and `stats` CLI commands.
|
||||||
|
- Added `run --dry-run` and `run --no-actions` for safer timer verification.
|
||||||
|
- Added TUI pause/resume support and a fullscreen running timer view with large ASCII time-left display.
|
||||||
|
- Added history recording for completed sessions and aggregate sleep/timer statistics.
|
||||||
|
- Added red highlighting for dangerous post-timer actions and common destructive custom commands.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- TUI settings now hide dependent options when their parent action is disabled.
|
||||||
|
- Release assets are published as a raw Linux binary plus `.sha256` instead of a tar archive.
|
||||||
|
|
||||||
|
## [1.1.3] - 2026-07-03
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Made the tag-based release workflow fail closed: lint and test gates now run before build and publish.
|
||||||
|
- Exposed Gitea Actions' built-in `${{ secrets.GITEA_TOKEN }}` to the release API steps so release creation and asset upload authenticate correctly.
|
||||||
|
|
||||||
|
## [1.1.2] - 2026-07-03
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Suppressed all background `stdout`/`stderr` writes while the Ratatui screen is active, including child command output from timer actions.
|
||||||
|
- Split `time left` out of the gauge label and reduced the gauge label to a compact percentage for narrow terminal safety.
|
||||||
|
|
||||||
## [1.1.1] - 2026-07-03
|
## [1.1.1] - 2026-07-03
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
@@ -13,4 +48,8 @@ The project uses semantic versioning. Tags are formatted as `vMAJOR.MINOR.PATCH`
|
|||||||
- Added YAML configuration, CLI `init`, `preview`, and `run` commands.
|
- Added YAML configuration, CLI `init`, `preview`, and `run` commands.
|
||||||
- Added Gitea CI and tag-based release workflows.
|
- Added Gitea CI and tag-based release workflows.
|
||||||
|
|
||||||
|
[1.2.1]: https://gitea.forust.xyz/forust/gosleep/releases/tag/v1.2.1
|
||||||
|
[1.2.0]: https://gitea.forust.xyz/forust/gosleep/releases/tag/v1.2.0
|
||||||
|
[1.1.3]: https://gitea.forust.xyz/forust/gosleep/releases/tag/v1.1.3
|
||||||
|
[1.1.2]: https://gitea.forust.xyz/forust/gosleep/releases/tag/v1.1.2
|
||||||
[1.1.1]: https://gitea.forust.xyz/forust/gosleep/releases/tag/v1.1.1
|
[1.1.1]: https://gitea.forust.xyz/forust/gosleep/releases/tag/v1.1.1
|
||||||
|
|||||||
Generated
+1
-1
@@ -298,7 +298,7 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gosleep-timer"
|
name = "gosleep-timer"
|
||||||
version = "1.1.1"
|
version = "1.2.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "gosleep-timer"
|
name = "gosleep-timer"
|
||||||
version = "1.1.1"
|
version = "1.2.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.85"
|
rust-version = "1.85"
|
||||||
description = "Terminal sleep timer for Linux desktop actions, with YAML config and a Rust TUI"
|
description = "Terminal sleep timer for Linux desktop actions, with YAML config and a Rust TUI"
|
||||||
|
|||||||
@@ -6,8 +6,7 @@ Rust TUI sleep timer for Linux desktop actions.
|
|||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
- Current version: `1.1.1`
|
- Release tags: `vMAJOR.MINOR.PATCH`
|
||||||
- Release tags: `vMAJOR.MINOR.PATCH`, for example `v1.1.1`
|
|
||||||
- Primary repository: <https://gitea.forust.xyz/forust/gosleep>
|
- Primary repository: <https://gitea.forust.xyz/forust/gosleep>
|
||||||
- SSH upstream: `ssh://git@gitssh.forust.xyz:2221/forust/gosleep.git`
|
- SSH upstream: `ssh://git@gitssh.forust.xyz:2221/forust/gosleep.git`
|
||||||
|
|
||||||
@@ -34,11 +33,11 @@ install -Dm755 target/release/gosleep-timer ~/.local/bin/gosleep-timer
|
|||||||
|
|
||||||
### From release artifact
|
### From release artifact
|
||||||
|
|
||||||
Download `gosleep-timer-<version>-linux-amd64.tar.gz` from the Gitea release page, then:
|
Download `gosleep-timer-<version>-linux-amd64` and its `.sha256` from the Gitea release page, then:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
tar -xzf gosleep-timer-1.1.1-linux-amd64.tar.gz
|
sha256sum -c gosleep-timer-<version>-linux-amd64.sha256
|
||||||
install -Dm755 gosleep-timer ~/.local/bin/gosleep-timer
|
install -Dm755 gosleep-timer-<version>-linux-amd64 ~/.local/bin/gosleep-timer
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -61,6 +60,24 @@ Preview commands that will run after the countdown:
|
|||||||
gosleep-timer preview
|
gosleep-timer preview
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Show the current config, enabled actions, and dangerous-action markers:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gosleep-timer status
|
||||||
|
```
|
||||||
|
|
||||||
|
Validate the config without starting the timer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gosleep-timer validate
|
||||||
|
```
|
||||||
|
|
||||||
|
Open the config in `$VISUAL`, `$EDITOR`, or `vi`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gosleep-timer edit
|
||||||
|
```
|
||||||
|
|
||||||
Run the saved timer config:
|
Run the saved timer config:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -74,6 +91,20 @@ gosleep-timer run 45m
|
|||||||
gosleep-timer run 1h30m
|
gosleep-timer run 1h30m
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Run the countdown without executing post-timer actions:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gosleep-timer run --dry-run 10s
|
||||||
|
gosleep-timer run --no-actions 10s
|
||||||
|
```
|
||||||
|
|
||||||
|
Inspect recorded sessions and aggregate stats:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gosleep-timer history
|
||||||
|
gosleep-timer stats
|
||||||
|
```
|
||||||
|
|
||||||
Use a custom config path:
|
Use a custom config path:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -90,6 +121,7 @@ gosleep-timer --config ./config.yaml preview
|
|||||||
| `Enter` while editing | Apply edit |
|
| `Enter` while editing | Apply edit |
|
||||||
| `Esc` while editing | Cancel edit |
|
| `Esc` while editing | Cancel edit |
|
||||||
| `r` | Start/restart timer |
|
| `r` | Start/restart timer |
|
||||||
|
| `p` | Pause/resume running timer |
|
||||||
| `x` | Stop timer |
|
| `x` | Stop timer |
|
||||||
| `s` | Save config |
|
| `s` | Save config |
|
||||||
| `q` / `Esc` | Quit |
|
| `q` / `Esc` | Quit |
|
||||||
@@ -155,6 +187,12 @@ Other actions use common Linux desktop tools:
|
|||||||
- `systemctl`
|
- `systemctl`
|
||||||
|
|
||||||
Install only the tools needed for the actions you enable.
|
Install only the tools needed for the actions you enable.
|
||||||
|
Dangerous actions such as `pkill`, power actions, and common destructive custom commands are highlighted in red in the TUI preview.
|
||||||
|
|
||||||
|
## History
|
||||||
|
|
||||||
|
Completed timer sessions are appended to `history.yaml` next to the active config file.
|
||||||
|
If no poweroff or reboot action is configured, CLI `run` asks for wake confirmation after the timer finishes and records the elapsed sleep time.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
@@ -185,7 +223,7 @@ Version is stored in:
|
|||||||
Release tags must match the package version:
|
Release tags must match the package version:
|
||||||
|
|
||||||
```bash
|
```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 --tags
|
git push origin main --tags
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -198,12 +236,11 @@ Required runner tools:
|
|||||||
- Rust stable toolchain with `cargo`, `rustfmt`, and `clippy`
|
- Rust stable toolchain with `cargo`, `rustfmt`, and `clippy`
|
||||||
- `curl`
|
- `curl`
|
||||||
- `jq`
|
- `jq`
|
||||||
- `tar`
|
|
||||||
- `sha256sum`
|
- `sha256sum`
|
||||||
|
|
||||||
Release authentication:
|
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.
|
- 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.
|
See [RELEASING.md](RELEASING.md) for the full release checklist.
|
||||||
|
|||||||
+17
-15
@@ -36,18 +36,17 @@ https://gitea.forust.xyz/forust/gosleep.git
|
|||||||
- `clippy`
|
- `clippy`
|
||||||
- `curl`
|
- `curl`
|
||||||
- `jq`
|
- `jq`
|
||||||
- `tar`
|
|
||||||
- `sha256sum`
|
- `sha256sum`
|
||||||
- Docker, if using the YAML lint job as written
|
- Docker, if using the YAML lint job as written
|
||||||
4. Confirm Actions job token permissions allow `contents: write`.
|
4. Confirm Actions job token permissions allow `contents: write`.
|
||||||
The release workflow uses Gitea Actions' built-in `GITEA_TOKEN`; no extra repository secret is required.
|
The release workflow uses Gitea Actions' built-in `GITEA_TOKEN`, exposed in the workflow as `${{ secrets.GITEA_TOKEN }}`; no extra repository secret is required.
|
||||||
|
|
||||||
## Version Bump Checklist
|
## 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
|
```bash
|
||||||
version=1.1.2
|
version=1.1.4
|
||||||
```
|
```
|
||||||
|
|
||||||
Update:
|
Update:
|
||||||
@@ -70,21 +69,23 @@ cargo build --release --locked
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
git status --short
|
git status --short
|
||||||
git commit -am "chore: release v1.1.2"
|
git commit -am "chore: release v${version}"
|
||||||
git tag -a v1.1.2 -m "gosleep-timer v1.1.2"
|
git tag -a "v${version}" -m "gosleep-timer v${version}"
|
||||||
git push origin main
|
git push origin main
|
||||||
git push origin v1.1.2
|
git push origin "v${version}"
|
||||||
```
|
```
|
||||||
|
|
||||||
The `.gitea/workflows/release.yaml` workflow will:
|
The `.gitea/workflows/release.yaml` workflow will:
|
||||||
|
|
||||||
1. Build `target/release/gosleep-timer`.
|
1. Re-run release gates: `cargo fmt --check`, `cargo test --locked`, `cargo clippy --locked -- -D warnings`, and YAML lint.
|
||||||
2. Package `gosleep-timer-<version>-linux-amd64.tar.gz`.
|
2. Build `target/release/gosleep-timer`.
|
||||||
3. Generate a SHA-256 checksum.
|
3. Copy binary as `gosleep-timer-<version>-linux-amd64`.
|
||||||
4. Create a Gitea release.
|
4. Generate a SHA-256 checksum.
|
||||||
5. Upload the archive and checksum as release assets.
|
5. Create a Gitea release.
|
||||||
|
6. Upload the binary and checksum as release assets.
|
||||||
|
|
||||||
The workflow is idempotent: if the release already exists, it reuses it and replaces assets with matching names.
|
The workflow is idempotent: if the release already exists, it reuses it and replaces assets with matching names.
|
||||||
|
If any lint or test step fails, the build and release job will not run.
|
||||||
|
|
||||||
## Manual Asset Build
|
## Manual Asset Build
|
||||||
|
|
||||||
@@ -94,7 +95,8 @@ If Actions are unavailable:
|
|||||||
version="$(cat VERSION)"
|
version="$(cat VERSION)"
|
||||||
cargo build --release --locked
|
cargo build --release --locked
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
cp target/release/gosleep-timer dist/gosleep-timer
|
binary="gosleep-timer-${version}-linux-amd64"
|
||||||
tar -C dist -czf "dist/gosleep-timer-${version}-linux-amd64.tar.gz" gosleep-timer
|
cp target/release/gosleep-timer "dist/${binary}"
|
||||||
sha256sum "dist/gosleep-timer-${version}-linux-amd64.tar.gz" > "dist/gosleep-timer-${version}-linux-amd64.tar.gz.sha256"
|
cd dist
|
||||||
|
sha256sum "${binary}" > "${binary}.sha256"
|
||||||
```
|
```
|
||||||
|
|||||||
+979
-66
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user