Files
woiken-sandboxes/.gitea/workflows/release.yml
T
niklas 9706e9aaf2
release / release (push) Successful in 2s
release / build (ubuntu-latest) (push) Successful in 1m0s
release / build (macos-arm64) (push) Successful in 21s
ps, rm --disk, release workflow
2026-10-02 17:08:19 +02:00

58 lines
2.0 KiB
YAML

name: release
on:
push:
tags: ["v*"]
env:
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
TOKEN: ${{ secrets.GITEA_TOKEN }}
TAG: ${{ github.ref_name }}
jobs:
release:
runs-on: ubuntu-latest
outputs:
id: ${{ steps.r.outputs.id }}
steps:
- id: r
run: |
auth="Authorization: token $TOKEN"
# Create, or reuse when re-running for an existing tag.
curl -sf -H "$auth" -H 'Content-Type: application/json' -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\"}" "$API/releases" >/dev/null || true
id=$(curl -sf -H "$auth" "$API/releases/tags/$TAG" | grep -o '^{"id":[0-9]*' | cut -d: -f2)
[ -n "$id" ]
echo "id=$id" >> "$GITHUB_OUTPUT"
build:
needs: release
strategy:
matrix:
os: [macos-arm64, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: toolchain
run: |
command -v rustup >/dev/null || curl -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
if ! command -v go >/dev/null; then
if command -v brew >/dev/null; then brew install go; else
curl -sSfL "https://go.dev/dl/$(curl -sSf 'https://go.dev/VERSION?m=text' | head -1).linux-$(dpkg --print-architecture).tar.gz" | tar -xz -C "$HOME"
echo "$HOME/go/bin" >> "$GITHUB_PATH"
fi
fi
- name: build
run: |
rustup toolchain install stable --profile minimal && rustup default stable
cargo test --locked
cargo build --release --locked
- name: upload
run: |
f="wsbx-$TAG-$(uname -s | tr A-Z a-z)-$(uname -m).tar.gz"
tar -czf "$f" -C target/release wsbx
(sha256sum "$f" 2>/dev/null || shasum -a 256 "$f") > "$f.sha256"
for a in "$f" "$f.sha256"; do
curl -sf -H "Authorization: token $TOKEN" -F "attachment=@$a" "$API/releases/${{ needs.release.outputs.id }}/assets?name=$a" >/dev/null
done