fix: publish valid release assets
This commit is contained in:
@@ -58,7 +58,8 @@ jobs:
|
|||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
binary="gosleep-timer-${version}-linux-amd64"
|
binary="gosleep-timer-${version}-linux-amd64"
|
||||||
cp target/release/gosleep-timer "dist/${binary}"
|
cp target/release/gosleep-timer "dist/${binary}"
|
||||||
sha256sum "dist/${binary}" > "dist/${binary}.sha256"
|
cd dist
|
||||||
|
sha256sum "${binary}" > "${binary}.sha256"
|
||||||
|
|
||||||
- name: Create Gitea release
|
- name: Create Gitea release
|
||||||
id: release
|
id: release
|
||||||
@@ -100,7 +101,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
release_url="https://gitea.forust.xyz/api/v1/repos/forust/gosleep/releases"
|
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/gosleep-timer-* dist/gosleep-timer-*.sha256; do
|
for asset in dist/gosleep-timer-*; do
|
||||||
name="$(basename "$asset")"
|
name="$(basename "$asset")"
|
||||||
release="$(curl -fsS \
|
release="$(curl -fsS \
|
||||||
"${release_url}/${release_id}" \
|
"${release_url}/${release_id}" \
|
||||||
|
|||||||
@@ -73,20 +73,21 @@ test "$(cat VERSION)" = "$(cargo metadata --no-deps --format-version 1 | jq -r '
|
|||||||
Release workflow is tag-based:
|
Release workflow is tag-based:
|
||||||
|
|
||||||
```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
|
git push origin main
|
||||||
git push origin v1.1.1
|
git push origin vMAJOR.MINOR.PATCH
|
||||||
```
|
```
|
||||||
|
|
||||||
The Gitea release workflow:
|
The Gitea release workflow:
|
||||||
|
|
||||||
|
- runs formatting, tests, clippy, and YAML lint before building
|
||||||
- builds `target/release/gosleep-timer`
|
- builds `target/release/gosleep-timer`
|
||||||
- creates `gosleep-timer-<version>-linux-amd64.tar.gz`
|
- copies `gosleep-timer-<version>-linux-amd64`
|
||||||
- writes a `.sha256`
|
- writes a `.sha256`
|
||||||
- creates or reuses the matching Gitea release
|
- creates or reuses the matching Gitea release
|
||||||
- replaces release assets with matching names
|
- 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
|
## Git Remote
|
||||||
|
|
||||||
|
|||||||
@@ -33,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-<version>-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
|
||||||
@@ -197,12 +197,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.
|
||||||
|
|||||||
+7
-7
@@ -36,7 +36,6 @@ 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`.
|
||||||
@@ -44,10 +43,10 @@ https://gitea.forust.xyz/forust/gosleep.git
|
|||||||
|
|
||||||
## 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,10 +69,10 @@ 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:
|
||||||
@@ -98,5 +97,6 @@ cargo build --release --locked
|
|||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
binary="gosleep-timer-${version}-linux-amd64"
|
binary="gosleep-timer-${version}-linux-amd64"
|
||||||
cp target/release/gosleep-timer "dist/${binary}"
|
cp target/release/gosleep-timer "dist/${binary}"
|
||||||
sha256sum "dist/${binary}" > "dist/${binary}.sha256"
|
cd dist
|
||||||
|
sha256sum "${binary}" > "${binary}.sha256"
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user