Run release job after build #47
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: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install latest Rust nightly | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
default: true | |
override: true | |
components: rustfmt, clippy | |
- name: Build | |
id: build | |
run: | | |
cargo build --release | |
version=$(target/release/decky --version | cut -d " " -f 2) | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Upload binary | |
uses: actions/[email protected] | |
with: | |
name: decky | |
path: target/release/decky | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
if: github.event_name != 'pull_request' | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: decky | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "decky" | |
skipIfReleaseExists: true | |
prerelease: ${{ github.event.inputs.releaseAsPrerelease || true }} | |
artifactErrorsFailBuild: true | |
artifactContentType: "application/octet-stream" | |
tag: ${{ steps.build.outputs.version }} |