feat: create a prettier and easier to edit config file #56
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: CI | |
on: | |
push: | |
branches: | |
- main | |
env: | |
RUST_BACKTRACE: 1 | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: sudo apt-get install libasound2-dev | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo check | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- run: sudo apt-get install libasound2-dev | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo fmt --all -- --check | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy | |
- run: sudo apt-get install libasound2-dev | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo clippy -- -D warnings | |
test-for-release: | |
needs: [check, fmt, clippy] | |
name: Test for 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@v3 | |
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 | |
- name: Update version | |
if: steps.semantic.outputs.new_release_published == 'true' | |
run: | | |
sed -i '/\[package\]/,/^version = "[^"]*"$/ s/^version = "[^"]*"$/version = "'"${{ steps.semantic.outputs.new_release_version }}"'"/' Cargo.toml | |
build-armhf: | |
needs: [test-for-release] | |
if: needs.test-for-release.outputs.new_release_published == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Install Rust Stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: Build | |
run: | | |
./build-deb.sh ${{ needs.test-for-release.outputs.new_release_version }} arm-unknown-linux-gnueabihf | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: deb-armhf | |
path: target/arm-unknown-linux-gnueabihf/debian/bloop-box_*_armhf.deb | |
build-arm64: | |
needs: [test-for-release] | |
if: needs.test-for-release.outputs.new_release_published == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Install Rust Stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: Build | |
run: | | |
./build-deb.sh ${{ needs.test-for-release.outputs.new_release_version }} aarch64-unknown-linux-gnu | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: deb-arm64 | |
path: target/aarch64-unknown-linux-gnu/debian/bloop-box_*_arm64.deb | |
release: | |
needs: [test-for-release, build-armhf, build-arm64] | |
name: Semantic Release | |
runs-on: ubuntu-latest | |
if: needs.test-for-release.outputs.new_release_published == 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v3 | |
- name: Install Rust Stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: Update version | |
run: | | |
sed -i '/\[package\]/,/^version = "[^"]*"$/ s/^version = "[^"]*"$/version = "'"${{ needs.test-for-release.outputs.new_release_version }}"'"/' Cargo.toml | |
cargo update --package bloop-box | |
- 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] |