Create Release #32
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: Create Release | |
| on: | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| build-app: | |
| name: Build Rust App | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-22.04 | |
| platform: linux | |
| - os: windows-2022 | |
| platform: windows | |
| - os: macos-13 | |
| platform: macos | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: taiki-e/install-action@just | |
| - name: Install dependencies (Linux) | |
| if: matrix.platform == 'linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libasound2-dev libjack-jackd2-dev libxkbcommon-dev protobuf-compiler | |
| - name: Install dependencies (Windows) | |
| if: matrix.platform == 'windows' | |
| run: choco install protoc -y | |
| - name: Install dependencies (macOS) | |
| if: matrix.platform == 'macos' | |
| run: brew install protobuf --quiet | |
| - name: Install Rust toolchain | |
| run: | | |
| rustup toolchain install stable --profile minimal | |
| if [[ "${{ matrix.platform }}" == "linux" ]]; then | |
| rustup target add x86_64-unknown-linux-gnu | |
| rustup component add rust-src --toolchain stable | |
| elif [[ "${{ matrix.platform }}" == "windows" ]]; then | |
| rustup target add i686-pc-windows-msvc x86_64-pc-windows-msvc | |
| elif [[ "${{ matrix.platform }}" == "macos" ]]; then | |
| rustup target add aarch64-apple-darwin x86_64-apple-darwin | |
| fi | |
| shell: bash | |
| - name: Set up Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "./RustApp -> target" | |
| - name: Install cargo-packager | |
| run: cargo install cargo-packager --locked | |
| - name: Package (Linux) | |
| if: matrix.platform == 'linux' | |
| working-directory: ./RustApp | |
| run: | | |
| just build-release --target x86_64-unknown-linux-gnu | |
| cargo packager -r -f appimage --target x86_64-unknown-linux-gnu | |
| - name: Package (Windows) | |
| if: matrix.platform == 'windows' | |
| working-directory: ./RustApp | |
| run: | | |
| just build-release --target x86_64-pc-windows-msvc | |
| cargo packager -r -f nsis --target x86_64-pc-windows-msvc | |
| just build-release --target i686-pc-windows-msvc | |
| cargo packager -r -f nsis --target i686-pc-windows-msvc | |
| - name: Package (macOS) | |
| if: matrix.platform == 'macos' | |
| working-directory: ./RustApp | |
| run: | | |
| just build-release --target x86_64-apple-darwin | |
| cargo packager -r -f dmg --target x86_64-apple-darwin | |
| just build-release --target aarch64-apple-darwin | |
| cargo packager -r -f dmg --target aarch64-apple-darwin | |
| # For Linux | |
| - name: Upload Linux binary | |
| if: matrix.platform == 'linux' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: androidmic-linux | |
| path: ./RustApp/target/x86_64-unknown-linux-gnu/release/*.AppImage | |
| if-no-files-found: warn | |
| # For Windows | |
| - name: Upload Windows built files | |
| if: matrix.platform == 'windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: androidmic-windows | |
| path: | | |
| ./RustApp/target/x86_64-pc-windows-msvc/release/*setup.exe | |
| ./RustApp/target/i686-pc-windows-msvc/release/*setup.exe | |
| if-no-files-found: warn | |
| # For macOS | |
| - name: Upload macOS built files | |
| if: matrix.platform == 'macos' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: androidmic-macos | |
| path: | | |
| ./RustApp/target/x86_64-apple-darwin/release/*.dmg | |
| ./RustApp/target/aarch64-apple-darwin/release/*.dmg | |
| if-no-files-found: warn | |
| build-android: | |
| name: Build Android App | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| cache: gradle | |
| - name: Build Release APK | |
| env: | |
| KEY_BASE64: ${{ secrets.KEY_BASE64 }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| STORE_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| working-directory: ./Android | |
| run: | | |
| echo $KEY_BASE64 | base64 --decode > app/key.jks | |
| ./gradlew assembleRelease | |
| - name: List APK files | |
| working-directory: ./Android | |
| run: find app/build/outputs -name "*.apk" | |
| - name: Upload Android APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: androidmic-android-apk | |
| path: ./Android/app/build/outputs/apk/release/*.apk | |
| if-no-files-found: warn | |
| create-release: | |
| name: Create GitHub Release | |
| needs: [build-app, build-android] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| path: all-artifacts | |
| - name: Display structure of downloaded files | |
| run: find all-artifacts -type f | sort | |
| - name: Extract version from Cargo.toml | |
| id: get_version | |
| run: | | |
| VERSION=$(grep '^version' ./RustApp/Cargo.toml | head -n 1 | awk -F '"' '{print $2}') | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ env.VERSION }} | |
| name: Release v${{ env.VERSION }} | |
| draft: true | |
| generate_release_notes: true | |
| files: all-artifacts/**/* | |
| body: | | |
| ## AndroidMic v${{ env.VERSION }} | |
| ### Release Notes | |
| <!-- You can add manual notes here, they will be combined with automated notes --> | |
| - Several improvements and bug fixed | |
| ### Installation | |
| - For Android: Install the `.apk` file | |
| - For Linux: Download and run the `.AppImage` binary | |
| - For Windows: Download and run the `.exe` installer | |
| - For macOS: Download and run the `.dmg` file |