Fix workflow to publish executable and add the missing License

This commit is contained in:
Alex Selimov 2026-03-19 15:55:25 -04:00
parent a2c678cdba
commit e5d0219df8
2 changed files with 33 additions and 20 deletions

View file

@ -1,4 +1,4 @@
name: Publish Cargo Package
name: Publish Release
on:
push:
@ -11,8 +11,6 @@ jobs:
runs-on: ubuntu-22.04
env:
CARGO_TERM_COLOR: always
CARGO_REGISTRIES_FORGEJO_TOKEN: Bearer ${{ secrets.FORGEJO_CARGO_TOKEN }}
FORGEJO_CARGO_INDEX: ${{ github.server_url }}/${{ github.repository_owner }}/_cargo-index.git
steps:
- name: Check out repository
uses: https://data.forgejo.org/actions/checkout@v4
@ -29,17 +27,6 @@ jobs:
rustup default stable
cargo --version
- name: Configure Cargo registry
run: |
mkdir -p "$HOME/.cargo"
cat > "$HOME/.cargo/config.toml" <<EOF
[registries.forgejo]
index = "${FORGEJO_CARGO_INDEX}"
[net]
git-fetch-with-cli = true
EOF
- name: Verify tag matches package version
if: startsWith(github.ref, 'refs/tags/v')
run: |
@ -56,12 +43,17 @@ jobs:
exit 1
fi
- name: Check package can be published
- name: Build release binary
run: |
. "$HOME/.cargo/env"
cargo publish --dry-run --locked --registry forgejo
cargo build --release --locked
mv target/release/upvoters upvoters-linux-x86_64
- name: Publish package
run: |
. "$HOME/.cargo/env"
cargo publish --locked --registry forgejo
- 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 }}