add demo #15
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: Multi-OS Binary Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
bin: demo | |
ext: "" | |
- os: windows-latest | |
target: x86_64-pc-windows-gnu | |
bin: demo | |
ext: ".exe" | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
bin: demo | |
ext: "" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
target: ${{ matrix.target }} | |
- name: Build binary | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --bin ${{ matrix.bin }} --manifest-path demo/Cargo.toml --target ${{ matrix.target }} | |
- name: List workspace output | |
run: | | |
echo "Listing workspace root directory:" | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
dir | |
else | |
ls -la | |
fi | |
echo "Listing general target directory:" | |
if [ "${{ runner.os }}" = "Windows" ]; then | |
dir "target/${{ matrix.target }}/release/" | |
else | |
ls -la "target/${{ matrix.target }}/release/" | |
fi | |
shell: bash | |
- name: Prepare assets | |
run: | | |
mkdir -p release/${{ matrix.bin }} | |
if [ -f "target/${{ matrix.target }}/release/${{ matrix.bin }}${{ matrix.ext }}" ]; then | |
cp "target/${{ matrix.target }}/release/${{ matrix.bin }}${{ matrix.ext }}" "release/${{ matrix.bin }}/${{ matrix.bin }}${{ matrix.ext }}" | |
else | |
echo "Binary not found, check build settings and output." | |
exit 1 | |
fi | |
shell: bash | |
- name: Zip assets | |
run: | | |
if ("${{ runner.os }}" -eq "Windows") { | |
Compress-Archive -Path "release/${{ matrix.bin }}/*" -DestinationPath "${{ matrix.bin }}-${{ matrix.os }}.zip" | |
} else { | |
zip -r "${{ matrix.bin }}-${{ matrix.os }}.zip" "release/${{ matrix.bin }}" | |
} | |
shell: pwsh | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.bin }}-${{ matrix.os }} | |
path: "${{ matrix.bin }}-${{ matrix.os }}.zip" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.bin }}-${{ matrix.os }} | |
path: "release/${{ matrix.bin }}-${{ matrix.os }}.zip" | |
release: | |
needs: [build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
path: downloaded-artifacts | |
- name: Create Release | |
uses: ncipollo/[email protected] | |
with: | |
artifacts: "downloaded-artifacts/*/*.zip" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref }} | |
owner: ${{ github.repository_owner }} | |
repo: butter2d |