|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + release: |
| 10 | + name: Release - ${{ matrix.platform.release_for }} |
| 11 | + runs-on: ${{ matrix.platform.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + platform: |
| 15 | + - release_for: Linux-x86_64 |
| 16 | + os: ubuntu-latest |
| 17 | + target: x86_64-unknown-linux-gnu |
| 18 | + bin: sshproxygen |
| 19 | + name: sshproxygen-linux-amd64 |
| 20 | + |
| 21 | + - release_for: Linux-aarch64 |
| 22 | + os: ubuntu-latest |
| 23 | + target: aarch64-unknown-linux-gnu |
| 24 | + bin: sshproxygen |
| 25 | + name: sshproxygen-linux-arm64 |
| 26 | + use_cross: true |
| 27 | + |
| 28 | + - release_for: macOS-x86_64 |
| 29 | + os: macos-latest |
| 30 | + target: x86_64-apple-darwin |
| 31 | + bin: sshproxygen |
| 32 | + name: sshproxygen-macos-amd64 |
| 33 | + |
| 34 | + - release_for: macOS-aarch64 |
| 35 | + os: macos-latest |
| 36 | + target: aarch64-apple-darwin |
| 37 | + bin: sshproxygen |
| 38 | + name: sshproxygen-macos-arm64 |
| 39 | + |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - name: Setup Rust toolchain |
| 44 | + uses: dtolnay/rust-toolchain@stable |
| 45 | + with: |
| 46 | + targets: ${{ matrix.platform.target }} |
| 47 | + |
| 48 | + - name: Install cross |
| 49 | + if: ${{ matrix.platform.use_cross }} |
| 50 | + run: cargo install cross |
| 51 | + |
| 52 | + - name: Build binary |
| 53 | + if: ${{ !matrix.platform.use_cross }} |
| 54 | + run: cargo build --verbose --release --target ${{ matrix.platform.target }} |
| 55 | + |
| 56 | + - name: Build binary using cross |
| 57 | + if: ${{ matrix.platform.use_cross }} |
| 58 | + run: cross build --verbose --release --target ${{ matrix.platform.target }} |
| 59 | + |
| 60 | + - name: Prepare binary |
| 61 | + run: | |
| 62 | + cd target/${{ matrix.platform.target }}/release |
| 63 | + cp ${{ matrix.platform.bin }} ${{ matrix.platform.name }} |
| 64 | + |
| 65 | + - name: Upload binaries to release |
| 66 | + uses: softprops/action-gh-release@v1 |
| 67 | + with: |
| 68 | + files: target/${{ matrix.platform.target }}/release/${{ matrix.platform.name }} |
| 69 | + env: |
| 70 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments