chore: prepare production rust release
ci / rust (push) Successful in 48s
ci / lint-yaml (push) Successful in 5s
release / linux-amd64 (push) Failing after 26s

This commit is contained in:
2026-07-03 15:45:22 +02:00
parent d1cc207ce4
commit 355e618c77
52 changed files with 2563 additions and 4077 deletions
+46
View File
@@ -0,0 +1,46 @@
name: ci
"on":
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
rust:
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: Build release binary
shell: bash
run: cargo build --release --locked
lint-yaml:
runs-on: [self-hosted, linux, arch, homelab]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Lint YAML
shell: bash
run: |
docker run --rm \
-v "$PWD:/work" \
-w /work \
cytopia/yamllint:latest \
-c .yamllint .
+75
View File
@@ -0,0 +1,75 @@
name: release
"on":
push:
tags:
- "v*.*.*"
workflow_dispatch:
permissions:
contents: write
jobs:
linux-amd64:
runs-on: [self-hosted, linux, arch, homelab]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build release binary
shell: bash
run: cargo build --release --locked
- name: Package artifact
shell: bash
run: |
tag="${GITHUB_REF##*/}"
version="${tag#v}"
mkdir -p dist
cp target/release/gosleep-timer dist/gosleep-timer
tar -C dist -czf "dist/gosleep-timer-${version}-linux-amd64.tar.gz" gosleep-timer
sha256sum "dist/gosleep-timer-${version}-linux-amd64.tar.gz" > "dist/gosleep-timer-${version}-linux-amd64.tar.gz.sha256"
- name: Create Gitea release
id: release
shell: bash
run: |
tag="${GITHUB_REF##*/}"
body="$(cat <<EOF
Release ${tag}
See CHANGELOG.md for notable changes.
EOF
)"
payload="$(jq -n \
--arg tag "${tag}" \
--arg commit "${GITHUB_SHA}" \
--arg name "gosleep-timer ${tag}" \
--arg body "$body" \
'{tag_name: $tag, target_commitish: $commit, name: $name, body: $body, draft: false, prerelease: false}')"
response="$(curl -fsS \
-X POST "${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "$payload")"
release_id="$(printf '%s' "$response" | jq -r '.id')"
test -n "$release_id" && test "$release_id" != "null"
echo "release_id=${release_id}" >> "$GITHUB_OUTPUT"
- name: Upload Gitea release assets
shell: bash
run: |
release_id="${{ steps.release.outputs.release_id }}"
for asset in dist/*.tar.gz dist/*.sha256; do
name="$(basename "$asset")"
curl -fsS \
-X POST "${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=${name}" \
-H "Authorization: token ${GITEA_TOKEN}" \
-F "attachment=@${asset}"
done
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: gosleep-timer-linux-amd64
path: dist/*