upvoters/.forgejo/workflows/publish.yml

60 lines
1.7 KiB
YAML
Raw Normal View History

name: Publish Release
2026-03-19 14:59:31 -04:00
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
publish:
2026-03-19 15:13:48 -04:00
runs-on: ubuntu-22.04
2026-03-19 14:59:31 -04:00
env:
CARGO_TERM_COLOR: always
steps:
- name: Check out repository
uses: https://data.forgejo.org/actions/checkout@v4
- name: Install Rust
run: |
if ! command -v cargo >/dev/null 2>&1; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
fi
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
. "$HOME/.cargo/env"
rustup toolchain install stable --profile minimal
rustup default stable
cargo --version
- name: Verify tag matches package version
if: startsWith(github.ref, 'refs/tags/v')
run: |
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)
tag="${GITHUB_REF_NAME#v}"
if [ -z "$version" ]; then
echo "Could not determine package version from Cargo.toml"
exit 1
fi
if [ "$version" != "$tag" ]; then
echo "Tag version ($tag) does not match Cargo.toml version ($version)"
exit 1
fi
- name: Build release binary
2026-03-19 14:59:31 -04:00
run: |
. "$HOME/.cargo/env"
cargo build --release --locked
mv target/release/upvoters upvoters-linux-x86_64
- name: Create release
uses: https://data.forgejo.org/actions/forgejo-release@v2
with:
direction: upload
tag: ${{ github.ref_name }}
release-notes: "Release ${{ github.ref_name }}"
files: upvoters-linux-x86_64
token: ${{ secrets.GITHUB_TOKEN }}