add cicd
Some checks failed
Release VPS agent / Build and publish Linux agent (push) Failing after 22s
Deploy control plane / Build, push, and deploy production (push) Failing after 22s

This commit is contained in:
2026-09-23 22:46:01 +03:00
parent 0fc35589e6
commit a10c2de01d
10 changed files with 743 additions and 3 deletions

View File

@@ -0,0 +1,83 @@
name: Release VPS agent
on:
push:
tags:
- "v*.*.*"
permissions:
contents: read
releases: write
jobs:
release-agent:
name: Build and publish Linux agent
runs-on: ubuntu-latest
timeout-minutes: 45
env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN: "1.85.1"
CROSS_VERSION: "0.2.5"
steps:
- name: Checkout tag
uses: https://gitea.com/actions/checkout@v4
with:
fetch-depth: 1
- name: Validate tag and package version
shell: bash
run: |
set -Eeuo pipefail
tag="${GITHUB_REF_NAME}"
if [[ ! "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
printf 'invalid release tag: %s\n' "$tag" >&2
exit 1
fi
package_version="$(awk -F ' *= *' '$1 == "version" {gsub(/"/, "", $2); print $2; exit}' agent/Cargo.toml)"
if [[ "v$package_version" != "$tag" ]]; then
printf 'tag %s does not match agent/Cargo.toml version %s\n' "$tag" "$package_version" >&2
exit 1
fi
- name: Prepare Rust and cross
shell: bash
run: |
set -Eeuo pipefail
for command_name in cargo rustup 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
rustup toolchain install "$RUST_TOOLCHAIN" --profile minimal --no-self-update
rustup override set "$RUST_TOOLCHAIN"
cargo install cross --version "$CROSS_VERSION" --locked
docker info >/dev/null
- name: Build static Linux binaries
shell: bash
run: |
set -Eeuo pipefail
cross build --locked --release --manifest-path agent/Cargo.toml --target x86_64-unknown-linux-musl
cross build --locked --release --manifest-path agent/Cargo.toml --target aarch64-unknown-linux-musl
- name: Package and verify assets
shell: bash
run: |
set -Eeuo pipefail
./scripts/package-agent-release.sh \
--output dist \
--amd64 agent/target/x86_64-unknown-linux-musl/release/vps-agent \
--arm64 agent/target/aarch64-unknown-linux-musl/release/vps-agent
file dist/vps-agent-linux-amd64 dist/vps-agent-linux-arm64
grep -q 'statically linked' < <(file -b dist/vps-agent-linux-amd64)
grep -q 'statically linked' < <(file -b dist/vps-agent-linux-arm64)
- name: Publish Gitea release
shell: bash
env:
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
set -Eeuo pipefail
./scripts/publish-gitea-release.sh "$GITHUB_REF_NAME" dist