Release #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
VERSION: 0.0.1 | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly-2022-11-06 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install linux build deps | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt install libxi-dev | |
sudo apt install libxtst-dev | |
- name: Build | |
shell: bash | |
run: HOOK_VERSION=${{ github.sha }} cargo +nightly-2022-11-06 build --release | |
- name: Upload artifact (windows) | |
uses: actions/upload-artifact@v4 | |
if: startsWith(matrix.os, 'windows') | |
with: | |
name: artifact-windows | |
path: ./target/release/dfint_hook.dll | |
- name: Upload artifact (linux) | |
uses: actions/upload-artifact@v4 | |
if: startsWith(matrix.os, 'ubuntu') | |
with: | |
name: artifact-linux | |
path: ./target/release/libdfint_hook.so | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Restore files | |
uses: actions/download-artifact@v4 | |
id: download | |
with: | |
pattern: artifact-* | |
merge-multiple: true | |
path: release | |
- name: Fetch version from Cargo.toml | |
run: echo VERSION=$(cat Cargo.toml | awk -F'"' '/^version/ {print $2}') >> $GITHUB_ENV | |
- name: Rename files | |
run: | | |
mv release/dfint_hook.dll release/hook_${{ env.VERSION }}.dll | |
mv release/libdfint_hook.so release/hook_${{ env.VERSION }}.so | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
release/hook_${{ env.VERSION }}.dll | |
release/hook_${{ env.VERSION }}.so | |
tag_name: ${{ env.VERSION }} | |
draft: true |