I released the first couple versions without updating the value in Cargo.toml. This will check for that happening again and abort the build.
33 lines
1.1 KiB
YAML
33 lines
1.1 KiB
YAML
---
|
|
on:
|
|
release:
|
|
types: [published]
|
|
jobs:
|
|
make-release:
|
|
runs-on: ubuntu-latest
|
|
name: Compile and upload a release build
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Get Cargo version
|
|
run: echo "cargo_version=v$(grep "^version" Cargo.toml | cut -d \" -f2)" >> $GITHUB_ENV
|
|
- name: Abort if Cargo.toml & Git Tag versions don't match
|
|
if: ${{ env.cargo_version != github.ref_name }}
|
|
run: exit 1
|
|
- name: Install Rust Stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
- name: Build binary crate
|
|
run: cargo build --release
|
|
- name: Rename binary to include architecture
|
|
run: mv target/release/gt-tool target/release/gt-tool-${{ github.ref_name }}-$(arch)
|
|
- name: Upload the program (using itself!)
|
|
run: >
|
|
target/release/gt-tool-${{ github.ref_name }}-$(arch)
|
|
-u ${{ vars.DEST_GITEA }} -r ${{ vars.DEST_REPO }}
|
|
upload-release
|
|
"${{ github.ref_name }}"
|
|
target/release/gt-tool-${{ github.ref_name }}-$(arch)
|
|
env:
|
|
RELEASE_KEY_GITEA: ${{ secrets.RELEASE_KEY_GITEA }}
|
|
...
|
|
|