72 lines
2.6 KiB
Markdown
72 lines
2.6 KiB
Markdown
# Gitea release pipeline
|
|
|
|
The workflow in `.gitea/workflows/release-agent.yml` runs only for pushed tags
|
|
matching `v*.*.*`. It then applies a stricter `vX.X.X` check, verifies that the
|
|
tag matches the version in `agent/Cargo.toml`, builds static Linux binaries for
|
|
amd64 and arm64, creates `SHA256SUMS`, and publishes all three files in a Gitea
|
|
release.
|
|
|
|
## Runner requirements
|
|
|
|
Register an amd64 Gitea Actions runner whose `ubuntu-latest` label resolves to a
|
|
Linux environment with:
|
|
|
|
- `bash`, `curl`, `jq`, `file`, `sha256sum`, Git, and CA certificates;
|
|
- Rustup and Cargo;
|
|
- Docker with permission for the runner user to access its daemon;
|
|
- outbound access to the Rust registries and the container registry used by
|
|
`cross`.
|
|
|
|
The job installs the pinned Rust 1.85.1 toolchain and `cross` 0.2.5. `cross`
|
|
uses Docker to build both musl targets; no amd64 or arm64 build host is required.
|
|
Do not expose the Docker daemon over an unauthenticated TCP socket.
|
|
|
|
The simplest setup is a dedicated runner VM with an `ubuntu-latest:host` label.
|
|
If jobs run inside a container instead, that container needs the Docker CLI and
|
|
controlled access to the host Docker socket. A runner that executes untrusted
|
|
repositories must not share this Docker access.
|
|
|
|
## Secrets, variables, and permissions
|
|
|
|
Configure this instance- or repository-level Actions secret:
|
|
|
|
- `RELEASE_TOKEN` (required): a Gitea access token for a dedicated automation
|
|
account with write access to releases in this repository. Store it as a
|
|
**secret**, not as a variable.
|
|
|
|
The workflow requests `contents: read` and `releases: write`. The token owner
|
|
must also be allowed to read the repository and create releases. Protect the
|
|
release tags so only trusted maintainers or automation can push them.
|
|
|
|
No custom Actions variables are required. Existing `REGISTRY_HOST`,
|
|
`REGISTRY_USERNAME`, and `REGISTRY_PASSWORD` values are deliberately unused:
|
|
this pipeline publishes release assets and does not push a container image.
|
|
Gitea supplies `GITHUB_API_URL`, `GITHUB_REPOSITORY`, and `GITHUB_REF_NAME` to
|
|
the job automatically.
|
|
|
|
## Publishing a release
|
|
|
|
First update `agent/Cargo.toml` and commit the change. Then create and push the
|
|
matching annotated tag:
|
|
|
|
```bash
|
|
git tag -a v0.1.0 -m "VPS Agent v0.1.0"
|
|
git push origin v0.1.0
|
|
```
|
|
|
|
After the job succeeds, the `v0.1.0` release contains:
|
|
|
|
- `vps-agent-linux-amd64`
|
|
- `vps-agent-linux-arm64`
|
|
- `SHA256SUMS`
|
|
|
|
The publisher refuses to overwrite an existing release. If a job fails while
|
|
uploading assets, it removes the incomplete release so that the same tag can be
|
|
rerun safely. It never deletes the Git tag.
|
|
|
|
Before installation, verify the downloaded binary:
|
|
|
|
```bash
|
|
sha256sum --check SHA256SUMS
|
|
```
|