Merge pull request #11 from jfreuden/bugfix/docker_run_command_status… #62
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: Rust | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
workflow_dispatch: | |
inputs: | |
releaseAsPrerelease: | |
description: 'Release as Prerelease' | |
required: true | |
type: boolean | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
name: Build for ${{ matrix.platform.release_for }} | |
strategy: | |
matrix: | |
platform: | |
- release_for: Linux-x86_64 | |
os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
name: decky-linux-x86_64 | |
- release_for: macOS-x86_64 | |
os: macOS-latest | |
target: x86_64-apple-darwin | |
name: decky-macOS-x86_64 | |
- release_for: macOS-aarch64 | |
os: macOS-latest | |
target: aarch64-apple-darwin | |
name: decky-macOS-aarch64 | |
runs-on: ${{ matrix.platform.os }} | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Rust cache for ${{ matrix.platform.release_for }} | |
uses: Swatinem/rust-cache@v2 | |
with: | |
prefix-key: rust-${{ matrix.platform.target }} | |
save-if: ${{ github.ref == 'refs/heads/main' }} | |
- name: Build binary | |
uses: houseabsolute/actions-rust-cross@v0 | |
with: | |
command: build | |
toolchain: nightly | |
target: ${{ matrix.platform.target }} | |
args: "--locked --release" | |
strip: true | |
- name: Upload binary | |
uses: actions/[email protected] | |
with: | |
name: ${{ matrix.platform.name }} | |
path: target/${{ matrix.platform.target }}/release/decky | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
if: github.event_name != 'pull_request' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Grab version | |
id: version | |
run: | | |
version=$(grep -iPo '(?<=^version = ")([^"]+)(?=")' Cargo.toml) | |
echo "Version code is $version" | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Rename artifacts name | |
run: | | |
cd artifacts | |
for i in *; do | |
mv $i/decky _$i | |
rm -rf $i | |
mv _$i $i | |
done | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "artifacts/*" | |
skipIfReleaseExists: true | |
prerelease: ${{ github.event.inputs.releaseAsPrerelease || true }} | |
artifactErrorsFailBuild: true | |
artifactContentType: "application/octet-stream" | |
tag: ${{ steps.version.outputs.version }} |