Release 0.8.0 #16
Workflow file for this run
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
# How to make a release | |
# Use the following command to create a release: | |
# - Update version in Cargo.toml | |
# version = "X.Y.Z" | |
# - Merge the PR to master | |
# - Create a tag with the version number | |
# git tag X.Y.Z | |
# - Push the tag to GitHub | |
# git push origin X.Y.Z | |
# - Go to releases page and edit the draft release | |
# - Publish the release | |
name: release | |
# Only do the release on x.y.z tags. | |
on: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
# We need this to be able to create releases. | |
permissions: | |
contents: write | |
jobs: | |
# The create-release job runs purely to initialize the GitHub release itself, | |
# and names the release after the `x.y.z` tag that was pushed. It's separate | |
# from building the release so that we only create the release once. | |
create-release: | |
name: create-release | |
runs-on: ubuntu-latest | |
env: | |
VERSION: | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get the release version from the tag | |
if: env.VERSION == '' | |
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV | |
- name: Show the version | |
run: | | |
echo "version is: $VERSION" | |
- name: Check that tag version and Cargo.toml version are the same | |
shell: bash | |
run: | | |
if ! grep -q "version = \"$VERSION\"" Cargo.toml; then | |
echo "version does not match Cargo.toml" >&2 | |
exit 1 | |
fi | |
- name: Create GitHub release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release create $VERSION --draft --verify-tag --title $VERSION | |
- name: Create version.json | |
shell: bash | |
run: | | |
cat <<EOF > version.json | |
{ | |
"version": "${{ env.VERSION }}", | |
"windows": "blue_onyx-${{ env.VERSION }}-win.zip", | |
"windows_sha256": "blue_onyx-${{ env.VERSION }}-win.zip.sha256", | |
"linux": "blue_onyx-${{ env.VERSION }}-linux.zip", | |
"linux_sha256": "blue_onyx-${{ env.VERSION }}-linux.zip.sha256" | |
} | |
EOF | |
- name: Upload version.json | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release upload ${{ env.VERSION }} version.json | |
- name: Upload install_latest_blue_onyx.ps1 | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release upload ${{ env.VERSION }} install_latest_blue_onyx.ps1 | |
outputs: | |
version: ${{ env.VERSION }} | |
build: | |
name: build | |
needs: ['create-release'] | |
env: | |
RUST_BACKTRACE: 1 | |
ASSET: | |
ASSET_SUM: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- build: win | |
os: windows-latest | |
rust: stable | |
- build: linux | |
os: ubuntu-latest | |
rust: stable | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
- name: Build release | |
run: cargo build --release | |
- name: Determine release binaries | |
shell: bash | |
run: | | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
BIN="target/release/blue_onyx.exe target/release/onnxruntime.dll target/release/DirectML.dll target/release/test_blue_onyx.exe target/release/blue_onyx_benchmark.exe target/release/blue_onyx_service.exe target/release/blue_onyx_download_models.exe" | |
else | |
BIN="target/release/blue_onyx target/release/libonnxruntime.so target/release/test_blue_onyx target/release/blue_onyx_benchmark target/release/blue_onyx_download_models" | |
fi | |
echo "BIN=$BIN" >> $GITHUB_ENV | |
- name: Determine archive name | |
shell: bash | |
run: | | |
version="${{ needs.create-release.outputs.version }}" | |
echo "ARCHIVE=blue_onyx-$version-${{ matrix.build }}" >> $GITHUB_ENV | |
- name: Creating directory for archive | |
shell: bash | |
run: | | |
mkdir -p "$ARCHIVE"/ | |
cp $BIN "$ARCHIVE"/ | |
- name: Build archive (Windows) | |
shell: bash | |
if: matrix.os == 'windows-latest' | |
run: | | |
7z a "$ARCHIVE.zip" "$ARCHIVE" | |
certutil -hashfile "$ARCHIVE.zip" SHA256 > "$ARCHIVE.zip.sha256" | |
echo "ASSET=$ARCHIVE.zip" >> $GITHUB_ENV | |
echo "ASSET_SUM=$ARCHIVE.zip.sha256" >> $GITHUB_ENV | |
- name: Build archive (Unix) | |
shell: bash | |
if: matrix.os != 'windows-latest' | |
run: | | |
tar czf "$ARCHIVE.tar.gz" "$ARCHIVE" | |
shasum -a 256 "$ARCHIVE.tar.gz" > "$ARCHIVE.tar.gz.sha256" | |
echo "ASSET=$ARCHIVE.tar.gz" >> $GITHUB_ENV | |
echo "ASSET_SUM=$ARCHIVE.tar.gz.sha256" >> $GITHUB_ENV | |
- name: Upload release archive | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: bash | |
run: | | |
version="${{ needs.create-release.outputs.version }}" | |
gh release upload "$version" ${{ env.ASSET }} ${{ env.ASSET_SUM }} |