Skip to content

Release

Release #2

Workflow file for this run

name: Release
on:
release:
types: [published]
jobs:
build:
name: Build and Upload
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v3
- name: Validate toolchain
run: |
echo "RUST_VERSION=$(rustc --version | cut -d ' ' -f 2)" >> ${GITHUB_ENV}
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/release
key: cargo-${{ runner.os }}-${{ runner.arch}}-${{ env.RUST_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-${{ runner.os }}-${{ runner.arch}}-${{ env.RUST_VERSION }}-
- name: Build binary
run: |
cargo build --release
- name: Prepare binary
id: prepare
run: |
case "${{ runner.os }}" in
Linux)
OS="linux"
;;
Windows)
OS="windows"
;;
macOS)
OS="macos"
;;
*)
OS="${{ runner.os }}"
;;
esac
case "${{ runner.arch }}" in
X64)
ARCH="x86_64"
;;
*)
ARCH="${{ runner.arch }}"
;;
esac
# Rename the file using the full tag name
TARGET="technique-${{ github.ref_name }}-${OS}-${ARCH}"
mv target/release/technique "${TARGET}"
echo "binary=${TARGET}" >> $GITHUB_OUTPUT
- name: Upload binary to Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
files: ${{ steps.prepare.outputs.binary }}