✨ Save image in different formats (#40) #19
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 | |
on: | |
push: | |
branches: ["main"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
name: Build project | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install nasm | |
uses: ilammy/setup-nasm@v1 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build | |
run: | | |
cargo build --release | |
- name: Get git commit hash (Windows) | |
if: ${{ contains('Windows', runner.os) }} | |
id: hash_windows | |
run: echo "hash=$("${{ github.sha }}".SubString(0, 10))" >> $env:GITHUB_OUTPUT | |
- name: Get git commit hash | |
if: ${{ !contains('Windows', runner.os) }} | |
id: hash | |
run: echo "hash=${GITHUB_SHA:0:10}" >> $GITHUB_OUTPUT | |
- name: Rename artifact (Windows) | |
if: ${{ contains('Windows', runner.os) }} | |
run: mv target/release/mltd.exe mltd-git-${{ steps.hash_windows.outputs.hash }}-Windows.exe | |
- name: Rename artifact | |
if: ${{ !contains('Windows', runner.os) }} | |
run: mv target/release/mltd mltd-git-${{ steps.hash.outputs.hash }}-${{ runner.os }} | |
- name: Publish artifact (Windows) | |
if: ${{ contains('Windows', runner.os) }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mltd-git-${{ steps.hash_windows.outputs.hash }}-Windows.exe | |
path: mltd-git-${{ steps.hash_windows.outputs.hash }}-Windows.exe | |
- name: Publish artifact | |
if: ${{ !contains('Windows', runner.os) }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mltd-git-${{ steps.hash.outputs.hash }}-${{ runner.os }} | |
path: mltd-git-${{ steps.hash.outputs.hash }}-${{ runner.os }} |