v0.5.11 release for restart material cfg #78
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
name: Build and Upload Release | |
on: | |
push: | |
tags: | |
- '**' | |
jobs: | |
release: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest, runner-mac-m1] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
if: matrix.os != 'runner-mac-m1' | |
- name: Cache Rust dependencies | |
uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.os }}-build-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build- | |
if: ${{ matrix.os }} != 'runner-mac-m1' | |
- name: Get SDL2 | |
run: | | |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then | |
sudo apt-get update | |
sudo apt-get install -y libsdl2-dev | |
elif [ "${{ matrix.os }}" == "macos-latest" ]; then | |
brew install SDL2 | |
elif [ "${{ matrix.os }}" == "windows-latest" ]; then | |
cp include/windows/* . | |
fi | |
shell: bash | |
if: ${{ matrix.os }} != 'gregoireh-1_macos-arm64-M1' | |
- name: Set environment | |
run: | | |
if [ "${{ matrix.os }}" == "windows-latest" ]; then | |
PLATFORM=windows | |
elif [ "${{ matrix.os }}" == "ubuntu-latest" ]; then | |
PLATFORM=ubuntu | |
elif [ "${{ matrix.os }}" == "macos-latest" ]; then | |
PLATFORM=macos-x86_64 | |
elif [ "${{ matrix.os }}" == "runner-mac-m1" ]; then | |
PLATFORM=macos-arm64 | |
fi | |
if [ "${{ matrix.os }}" == "windows-latest" ]; then | |
EXT=.exe | |
OUT_EXT=.exe | |
else | |
EXT= | |
OUT_EXT=.tar.gz | |
fi | |
BUNDLE_NAME=kalast-$GITHUB_REF_NAME-$PLATFORM | |
RELEASE_FILE=$BUNDLE_NAME$OUT_EXT | |
echo "PLATFORM=$PLATFORM" >> "$GITHUB_ENV" | |
echo "EXT=$EXT" >> "$GITHUB_ENV" | |
echo "OUT_EXT=$OUT_EXT" >> "$GITHUB_ENV" | |
echo "BUNDLE_NAME=$BUNDLE_NAME" >> "$GITHUB_ENV" | |
echo "RELEASE_FILE=$RELEASE_FILE" >> "$GITHUB_ENV" | |
shell: bash | |
- name: Build | |
run: | | |
echo "Build main executable." | |
cargo build -r --all-features && strip target/release/kalast$EXT | |
# echo "Build custom executable for specific example." | |
# cargo build -r --all-features --example viewer-picker && strip target/release/examples/viewer-picker$EXT | |
shell: bash | |
- name: Prepare bundle | |
run: | | |
mkdir -p bundle | |
cp -r examples bundle | |
cp target/release/kalast$EXT bundle | |
# cp target/release/examples/viewer-picker$EXT bundle/examples/viewer-picker | |
cp include/kalast.ico bundle | |
cp -r include/assets bundle | |
cp preferences.toml bundle | |
cp README.md bundle | |
if [ "${{ matrix.os }}" == "windows-latest" ]; then | |
cp include/windows/* bundle | |
fi | |
cd bundle | |
cp -r examples/viewer/cfg . | |
cd .. | |
shell: bash | |
- name: Finish bundle Linux/MacOS | |
if: matrix.os != 'windows-latest' | |
run: | | |
mv bundle $BUNDLE_NAME | |
tar cvzf $RELEASE_FILE $BUNDLE_NAME | |
- name: Finish bundle Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
cp scripts\installer.iss . | |
iscc installer.iss /DVERSION=${{ github.ref_name }} /DSETUP_NAME=${{ env.BUNDLE_NAME }} | |
- uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ env.RELEASE_FILE }} | |
prerelease: true |