diff --git a/.gitea/workflows/release-agent.yml b/.gitea/workflows/release-agent.yml index 949dc99..6b9e942 100644 --- a/.gitea/workflows/release-agent.yml +++ b/.gitea/workflows/release-agent.yml @@ -44,12 +44,24 @@ jobs: shell: bash run: | set -Eeuo pipefail - for command_name in cargo rustup docker curl jq file sha256sum; do + for command_name in docker curl jq file sha256sum; do command -v "$command_name" >/dev/null || { printf 'runner prerequisite is missing: %s\n' "$command_name" >&2 exit 1 } done + if ! command -v rustup >/dev/null || ! command -v cargo >/dev/null; then + rustup_installer="$(mktemp "${RUNNER_TEMP:-/tmp}/rustup-init.XXXXXX")" + trap 'rm -f "$rustup_installer"' EXIT + curl --proto '=https' --tlsv1.2 --fail --silent --show-error \ + https://sh.rustup.rs \ + --output "$rustup_installer" + sh "$rustup_installer" -y --profile minimal --default-toolchain none + export PATH="${CARGO_HOME:-$HOME/.cargo}/bin:$PATH" + printf '%s\n' "${CARGO_HOME:-$HOME/.cargo}/bin" >> "$GITHUB_PATH" + fi + command -v rustup >/dev/null || { printf 'rustup installation failed\n' >&2; exit 1; } + command -v cargo >/dev/null || { printf 'cargo installation failed\n' >&2; exit 1; } rustup toolchain install "$RUST_TOOLCHAIN" --profile minimal --no-self-update rustup override set "$RUST_TOOLCHAIN" cargo install cross --version "$CROSS_VERSION" --locked diff --git a/agent/Cargo.toml b/agent/Cargo.toml index 9a6ce7d..c7d631c 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vps-agent" -version = "0.1.3" +version = "0.1.4" edition = "2021" rust-version = "1.80" license = "Apache-2.0" diff --git a/docs/gitea-release.md b/docs/gitea-release.md index 0e7b13a..6d7ab2c 100644 --- a/docs/gitea-release.md +++ b/docs/gitea-release.md @@ -12,14 +12,14 @@ 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. +When Rustup or Cargo is absent, the job bootstraps Rustup using its official TLS +installer. It then 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