Skip to content

Str 199

Str 199 #4

Workflow file for this run

name: Release
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
pull_request:
paths:
- '.github/workflows/release.yml'
push:
tags:
- 'v*'
branches:
- master
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
release:
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
runs-on: ${{ matrix.os }}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@v10
with:
root-reserve-mb: 4096
remove-dotnet: true
remove-android: true
remove-haskell: true
remove-codeql: true
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
./target
key: v1-${{ matrix.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
v1-${{ matrix.os }}-${{ hashFiles('rust-toolchain.toml') }}
- name: Set Rust version
run: |
RUST_VERSION="$(grep -oP 'channel = \"\K[0-9]+\.[0-9]+\.[0-9]+' rust-toolchain.toml)"
echo "RUST_STABLE=$RUST_VERSION" >> $GITHUB_ENV
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_STABLE }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libsasl2-dev protobuf-compiler
- name: Extract tag name
run: |
echo "BUILD_NAME=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV"
- name: Build release binary
run: cargo build --release
- name: Remove debug information
run: strip --strip-debug target/release/thorofare
- name: Rename binary to include OS
run: |
mv target/release/thorofare target/release/thorofare-${{ matrix.os }}
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.BUILD_NAME }}
files: target/release/thorofare-${{ matrix.os }}
draft: false
prerelease: false