|
| 1 | +on: |
| 2 | + release: |
| 3 | + types: [created] |
| 4 | + |
| 5 | +jobs: |
| 6 | + release: |
| 7 | + env: |
| 8 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 9 | + CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }} |
| 10 | + |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + include: |
| 15 | + - name: Linux-x86_64 |
| 16 | + target: x86_64-unknown-linux-gnu |
| 17 | + runner: ubuntu-latest |
| 18 | + |
| 19 | + - name: macOS-Apple |
| 20 | + target: aarch64-apple-darwin |
| 21 | + runner: macos-latest |
| 22 | + |
| 23 | + - name: macOS-Intel |
| 24 | + target: x86_64-apple-darwin |
| 25 | + runner: macos-latest |
| 26 | + |
| 27 | + - name: Windows |
| 28 | + target: i686-pc-windows-msvc |
| 29 | + runner: windows-latest |
| 30 | + |
| 31 | + name: ${{ matrix.name }} |
| 32 | + runs-on: ${{ matrix.runner }} |
| 33 | + steps: |
| 34 | + - name: Fetch Repository |
| 35 | + uses: actions/checkout@v3 |
| 36 | + |
| 37 | + - name: Update Rust Toolchain |
| 38 | + run: rustup update stable |
| 39 | + |
| 40 | + - name: Add Rust Target |
| 41 | + run: rustup target add ${{ matrix.target }} |
| 42 | + |
| 43 | + - name: Build Release (Windows) |
| 44 | + if: ${{ matrix.runner == 'windows-latest' }} |
| 45 | + run: cargo build --release --target ${{ matrix.target }} |
| 46 | + |
| 47 | + - name: Bundle Release (Other) |
| 48 | + if: ${{ matrix.runner != 'windows-latest' }} |
| 49 | + run: | |
| 50 | + cargo install --git https://github.com/burtonageo/cargo-bundle.git |
| 51 | + cargo bundle --release --target ${{ matrix.target }} |
| 52 | +
|
| 53 | + - name: Create Zip Archive (Windows) |
| 54 | + if: ${{ matrix.runner == 'windows-latest' }} |
| 55 | + run: bash -c '7z a ${{ matrix.name }}.zip ./target/${{ matrix.target }}/release/*.exe' |
| 56 | + |
| 57 | + - name: Create Zip Archive (macOS) |
| 58 | + if: ${{ matrix.runner == 'macos-latest' }} |
| 59 | + run: cd target/${{ matrix.target }}/release/bundle/osx && zip -r ../../../../../${{ matrix.name }}.zip * |
| 60 | + |
| 61 | + - name: Create Zip Archive (Linux) |
| 62 | + if: ${{ matrix.runner == 'ubuntu-latest' }} |
| 63 | + run: zip -j ${{ matrix.name }}.zip target/${{ matrix.target }}/release/bundle/deb/* |
| 64 | + |
| 65 | + - name: Upload Zip Archive |
| 66 | + run: gh release upload ${{ github.ref_name }} ${{ matrix.name }}.zip --clobber |
0 commit comments