ci: fix artifact download names #21
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: Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
env: | |
RUST_BACKTRACE: 1 | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- run: sudo apt-get install libdbus-1-dev libssl-dev libxdo-dev | |
- run: cargo check | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- run: sudo apt-get install libdbus-1-dev libssl-dev libxdo-dev | |
- run: cargo fmt --all -- --check | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- uses: Swatinem/rust-cache@v2 | |
- run: sudo apt-get install libdbus-1-dev libssl-dev libxdo-dev | |
- run: cargo clippy -- -D warnings | |
check-release: | |
needs: [ check, fmt, clippy ] | |
name: Check Release | |
runs-on: ubuntu-latest | |
if: github.actor != 'sbosnick-bot' | |
outputs: | |
new_release_published: ${{ steps.semantic.outputs.new_release_published }} | |
new_release_version: ${{ steps.semantic.outputs.new_release_version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Semantic Release | |
uses: cycjimmy/semantic-release-action@v4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
id: semantic | |
with: | |
dry_run: true | |
build: | |
needs: [ check-release ] | |
if: needs.check-release.outputs.new_release_published == 'true' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [ linux-x64, windows-x64 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust Stable | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- run: sudo apt-get install libdbus-1-dev libssl-dev libxdo-dev | |
- name: Update version | |
run: | | |
sed -i '/\[package\]/,/^version = "[^"]*"$/ s/^version = "[^"]*"$/version = "'"${{ needs.check-release.outputs.new_release_version }}"'"/' Cargo.toml | |
cargo update --package vrc-osc-manager | |
shell: bash | |
- name: Build Binary | |
run: | | |
if [ "${{ matrix.target }}" == "linux-x64" ]; then | |
cargo build --release --target x86_64-unknown-linux-gnu | |
cp target/x86_64-unknown-linux-gnu/release/vrc-osc-manager ./vrc-osc-manager | |
else | |
cargo install cross --git https://github.com/rust-embedded/cross | |
cross build --release --target x86_64-pc-windows-gnu | |
cp target/x86_64-pc-windows-gnu/release/vrc-osc-manager.exe ./vrc-osc-manager.exe | |
fi | |
shell: bash | |
- name: Upload Binary Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.target }}-binary | |
path: | | |
./vrc-osc-manager | |
./vrc-osc-manager.exe | |
semantic-release: | |
needs: [ build ] | |
if: needs.check-release.outputs.new_release_published == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust Stable | |
uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- name: Download Binaries | |
uses: actions/download-artifact@v4 | |
with: | |
name: vrc-osc-manager | |
path: ./release-artifacts/ | |
- name: Download Windows Binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: vrc-osc-manager.exe | |
path: ./release-artifacts/ | |
- name: Update version | |
run: | | |
sed -i '/\[package\]/,/^version = "[^"]*"$/ s/^version = "[^"]*"$/version = "'"${{ needs.check-release.outputs.new_release_version }}"'"/' Cargo.toml | |
cargo update --package vrc-osc-manager | |
shell: bash | |
- name: Semantic Release | |
uses: cycjimmy/semantic-release-action@v4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
id: semantic | |
with: | |
extra_plugins: | | |
@semantic-release/[email protected] | |
@semantic-release/[email protected] | |
@semantic-release/[email protected] | |
@semantic-release/[email protected] |