name: Publish Release on: push: tags: - "v*" workflow_dispatch: jobs: publish: runs-on: ubuntu-22.04 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 run: | . "$HOME/.cargo/env" cargo build --release --locked mkdir -p dist/release mv target/release/upvoters dist/release/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 }}" token: ${{ secrets.GITHUB_TOKEN }}