|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [main] |
| 5 | + release: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + build_and_upload: |
| 10 | + name: Build release |
| 11 | + timeout-minutes: 15 |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + container: |
| 14 | + image: ${{ matrix.image }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + os: [ubuntu-latest, macos-latest] |
| 19 | + archive_ext: [tar.gz] |
| 20 | + archive_cmd: ["tar cf"] |
| 21 | + include: |
| 22 | + - os: ubuntu-latest |
| 23 | + osname: linux |
| 24 | + # We build on an old Linux distro so that we get an older version of libstdc++. |
| 25 | + # libstdc++ has good backwards compatibility (but not forwards) so by linking against an |
| 26 | + # old version, we can target more Linuxes. |
| 27 | + image: debian:oldstable |
| 28 | + - os: windows-latest |
| 29 | + osname: windows |
| 30 | + archive_ext: zip |
| 31 | + archive_cmd: 7z a |
| 32 | + exe_suffix: .exe |
| 33 | + - os: macos-latest |
| 34 | + osname: macos_arm |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + - name: Install extra dependencies on Linux |
| 38 | + if: ${{ matrix.osname == 'linux' }} |
| 39 | + run: | |
| 40 | + apt update |
| 41 | + apt install -y curl build-essential cmake libclang-16-dev |
| 42 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 43 | + with: |
| 44 | + toolchain: stable |
| 45 | + - run: cargo build --release |
| 46 | + - name: Gather release files |
| 47 | + run: | |
| 48 | + mkdir muse2 |
| 49 | + cp target/release/muse2${{ matrix.exe_suffix }} muse2 |
| 50 | + cp LICENSE muse2/LICENCE.txt |
| 51 | + cp assets/readme/readme_${{ matrix.osname }}.txt muse2/README.txt |
| 52 | + - uses: actions/upload-artifact@v4 |
| 53 | + if: ${{ github.event_name != 'release' }} |
| 54 | + with: |
| 55 | + name: muse2_${{ matrix.osname }} |
| 56 | + path: muse2 |
| 57 | + - name: Archive release |
| 58 | + if: ${{ github.event_name == 'release' }} |
| 59 | + run: | |
| 60 | + cd muse2 |
| 61 | + ${{ matrix.archive_cmd }} ../muse2_${{ matrix.osname }}.${{ matrix.archive_ext }} * |
| 62 | + - name: Upload release artifacts |
| 63 | + if: ${{ github.event_name == 'release' }} |
| 64 | + uses: softprops/action-gh-release@v2 |
| 65 | + with: |
| 66 | + files: muse2_${{ matrix.osname }}.${{ matrix.archive_ext }} |
0 commit comments