fix: improve formatting check in CI workflow and correct macOS depend… #2
Workflow file for this run
This file contains hidden or 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: | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build: | |
| name: Build ${{ matrix.target.name }} | |
| runs-on: ${{ matrix.target.runner }} | |
| needs: create-release | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: | |
| - name: macOS ARM64 | |
| runner: macos-latest | |
| artifact: transcriber-macos-aarch64 | |
| - name: macOS x86_64 | |
| runner: macos-latest | |
| artifact: transcriber-macos-x86_64 | |
| - name: Linux x86_64 | |
| runner: ubuntu-latest | |
| artifact: transcriber-linux-x86_64 | |
| - name: Windows x86_64 | |
| runner: windows-latest | |
| artifact: transcriber-windows-x86_64.exe | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Install deps (Linux) | |
| if: matrix.target.runner == 'ubuntu-latest' | |
| run: sudo apt-get update && sudo apt-get install -y libopus-dev libasound2-dev libsamplerate0-dev pkg-config libssl-dev cmake build-essential | |
| - name: Install deps (macOS) | |
| if: matrix.target.runner == 'macos-latest' | |
| run: brew install cmake pkg-config opus libsndfile samplerate | |
| - name: Build | |
| run: cargo build --release | |
| - name: Prepare artifact | |
| shell: bash | |
| run: | | |
| mkdir -p dist | |
| if [ "${{ matrix.target.runner }}" = "windows-latest" ]; then | |
| cp target/release/transcriber.exe dist/${{ matrix.target.artifact }} | |
| else | |
| cp target/release/transcriber dist/${{ matrix.target.artifact }} | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-release-asset@v2 | |
| with: | |
| upload_url: ${{ needs.create-release.outputs.upload_url }} | |
| asset_path: ./dist/${{ matrix.target.artifact }} | |
| asset_name: ${{ matrix.target.artifact }} |