记住寮舍展示中不显示的角色 #67
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: build | |
| on: | |
| push: | |
| tags: | |
| - "[0-9]+.[0-9]+.[0-9]+" | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| APT_PACKAGES: "build-essential pkg-config libclang-dev" | |
| BIN_NAME: majsoul_max_rs | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build binary | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [linux, musllinux, android, windows, macos] | |
| target_arch: [x86_64, aarch64] | |
| include: | |
| # rust target vendor + system + environment | |
| - os: android | |
| target_vendor_sys_env: linux-android | |
| - os: macos | |
| target_vendor_sys_env: apple-darwin | |
| - os: linux | |
| target_vendor_sys_env: unknown-linux-gnu | |
| - os: musllinux | |
| target_vendor_sys_env: unknown-linux-musl | |
| - os: windows | |
| target_vendor_sys_env: pc-windows-msvc | |
| # runner | |
| - target_arch: x86_64 | |
| runner: ubuntu-latest | |
| - target_arch: aarch64 | |
| runner: ubuntu-24.04-arm | |
| - os: android | |
| runner: ubuntu-latest | |
| - os: windows | |
| runner: windows-latest | |
| - os: macos | |
| runner: macos-latest | |
| # musl packages | |
| - os: musllinux | |
| musl_packages: "clang musl-tools musl-dev" | |
| exclude: | |
| - os: android | |
| target_arch: x86_64 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install APT packages | |
| if: contains(matrix.runner, 'ubuntu') | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ${{ | |
| matrix.musl_packages || '' | |
| }} ${{ | |
| env.APT_PACKAGES || '' | |
| }} | |
| - name: Add Rust target | |
| shell: bash | |
| id: target | |
| run: | | |
| echo "triple=${{ matrix.target_arch }}-${{matrix.target_vendor_sys_env}}" >> $GITHUB_OUTPUT | |
| rustup target add ${{ matrix.target_arch }}-${{matrix.target_vendor_sys_env}} && rustup update | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: nttld/setup-ndk@v1.5.0 | |
| if: ${{ matrix.os == 'android' }} | |
| id: setup-ndk | |
| with: | |
| ndk-version: r27c | |
| add-to-path: true | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Build ${{ steps.target.outputs.triple }} | |
| if: ${{ matrix.os != 'android' }} | |
| shell: bash | |
| run: | | |
| if [ ${{ matrix.os }} == "musllinux" ]; then | |
| export CXX=${{ matrix.target_arch }}-linux-gnu-g++ | |
| export CFLAGS="-D_FORTIFY_SOURCE=0" | |
| export CXXFLAGS="-D_FORTIFY_SOURCE=0" | |
| fi | |
| if [ ${{ matrix.os }} == "windows" ]; then | |
| export RUSTFLAGS="-C target-feature=+crt-static" | |
| fi | |
| cargo build --release --target ${{ steps.target.outputs.triple }} | |
| - name: Build with Android NDK | |
| if: ${{ matrix.os == 'android' }} | |
| run: | | |
| cargo install cargo-ndk | |
| cargo ndk --target ${{ steps.target.outputs.triple }} build --release | |
| env: | |
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| - name: Move artifacts to work dir and zip | |
| shell: bash | |
| run: | | |
| mv target/${{ steps.target.outputs.triple }}/release/${{ env.BIN_NAME}} . | |
| mkdir -p release-package | |
| mv ${{ env.BIN_NAME}} release-package/ | |
| # Include Liqi configuration directory in the packaged artifact | |
| cp -r liqi_config release-package/ | |
| cd release-package | |
| if [ ${{ matrix.os }} == "windows" ]; then | |
| 7z a -tzip ../${{ env.BIN_NAME}}-${{ matrix.os }}-${{matrix.target_arch}}.zip . | |
| else | |
| zip -r ../${{ env.BIN_NAME}}-${{ matrix.os }}-${{matrix.target_arch}}.zip . | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.BIN_NAME}}-${{ matrix.os }}-${{matrix.target_arch}} | |
| path: ${{ env.BIN_NAME}}-${{ matrix.os }}-${{matrix.target_arch}}.zip | |
| retention-days: 1 | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: master # Ensure we get the latest master with RELEASE_NOTES.md | |
| fetch-depth: 0 # Full history for consistency | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: List downloaded artifacts | |
| run: ls -R artifacts | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: artifacts/**/${{ env.BIN_NAME}}*.zip | |
| name: ${{ github.ref_name }} | |
| draft: false | |
| prerelease: false | |
| fail_on_unmatched_files: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |