|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'simplicityhl-[0-9]+.[0-9]+.[0-9]+' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + tag: |
| 10 | + description: 'Tag to build (e.g. simplicityhl-0.4.1)' |
| 11 | + required: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + name: Build ${{ matrix.target }} |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + include: |
| 21 | + - target: x86_64-unknown-linux-musl |
| 22 | + os: ubuntu-latest |
| 23 | + binary: simc |
| 24 | + archive: simc-linux-x86_64.tar.gz |
| 25 | + - target: aarch64-unknown-linux-musl |
| 26 | + os: ubuntu-latest |
| 27 | + binary: simc |
| 28 | + archive: simc-linux-aarch64.tar.gz |
| 29 | + - target: x86_64-apple-darwin |
| 30 | + os: macos-latest |
| 31 | + binary: simc |
| 32 | + archive: simc-macos-x86_64.tar.gz |
| 33 | + - target: aarch64-apple-darwin |
| 34 | + os: macos-latest |
| 35 | + binary: simc |
| 36 | + archive: simc-macos-aarch64.tar.gz |
| 37 | + - target: x86_64-pc-windows-msvc |
| 38 | + os: windows-latest |
| 39 | + binary: simc.exe |
| 40 | + archive: simc-windows-x86_64.zip |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + ref: ${{ github.event.inputs.tag || github.ref }} |
| 47 | + |
| 48 | + - name: Install Rust toolchain |
| 49 | + uses: dtolnay/rust-toolchain@stable |
| 50 | + with: |
| 51 | + targets: ${{ matrix.target }} |
| 52 | + |
| 53 | + - name: Install cross (Linux cross-compilation) |
| 54 | + if: runner.os == 'Linux' |
| 55 | + run: cargo install cross --git https://github.com/cross-rs/cross |
| 56 | + |
| 57 | + - name: Build (Linux) |
| 58 | + if: runner.os == 'Linux' |
| 59 | + run: cross build --release --bin simc --target ${{ matrix.target }} |
| 60 | + |
| 61 | + - name: Build (macOS / Windows) |
| 62 | + if: runner.os != 'Linux' |
| 63 | + run: cargo build --release --bin simc --target ${{ matrix.target }} |
| 64 | + |
| 65 | + - name: Package (Unix) |
| 66 | + if: runner.os != 'Windows' |
| 67 | + run: | |
| 68 | + cp target/${{ matrix.target }}/release/${{ matrix.binary }} simc |
| 69 | + tar czf ${{ matrix.archive }} simc |
| 70 | + rm simc |
| 71 | +
|
| 72 | + - name: Package (Windows) |
| 73 | + if: runner.os == 'Windows' |
| 74 | + shell: pwsh |
| 75 | + run: | |
| 76 | + Copy-Item "target/${{ matrix.target }}/release/${{ matrix.binary }}" "simc.exe" |
| 77 | + Compress-Archive -Path "simc.exe" -DestinationPath "${{ matrix.archive }}" |
| 78 | + Remove-Item "simc.exe" |
| 79 | +
|
| 80 | + - name: Upload artifact |
| 81 | + uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: ${{ matrix.archive }} |
| 84 | + path: ${{ matrix.archive }} |
| 85 | + |
| 86 | + release: |
| 87 | + name: Create Release |
| 88 | + needs: build |
| 89 | + runs-on: ubuntu-latest |
| 90 | + permissions: |
| 91 | + contents: write |
| 92 | + steps: |
| 93 | + - name: Download all artifacts |
| 94 | + uses: actions/download-artifact@v4 |
| 95 | + with: |
| 96 | + merge-multiple: true |
| 97 | + |
| 98 | + - name: Create GitHub release |
| 99 | + uses: softprops/action-gh-release@v2 |
| 100 | + with: |
| 101 | + tag_name: ${{ github.event.inputs.tag || github.ref_name }} |
| 102 | + name: ${{ github.event.inputs.tag || github.ref_name }} |
| 103 | + files: | |
| 104 | + simc-linux-x86_64.tar.gz |
| 105 | + simc-linux-aarch64.tar.gz |
| 106 | + simc-macos-x86_64.tar.gz |
| 107 | + simc-macos-aarch64.tar.gz |
| 108 | + simc-windows-x86_64.zip |
0 commit comments