release.yml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. name: Release
  2. on:
  3. push:
  4. tags:
  5. - '*'
  6. env:
  7. CARGO_TERM_COLOR: always
  8. jobs:
  9. release:
  10. name: Cross build for ${{ matrix.target }}
  11. runs-on: ${{ matrix.os }}
  12. strategy:
  13. matrix:
  14. include:
  15. - os: ubuntu-latest
  16. target: x86_64-unknown-linux-gnu
  17. exe: rathole
  18. - os: ubuntu-latest
  19. target: x86_64-unknown-linux-musl
  20. exe: rathole
  21. - os: ubuntu-latest
  22. target: aarch64-unknown-linux-musl
  23. exe: rathole
  24. - os: ubuntu-latest
  25. target: mips-unknown-linux-musl
  26. exe: rathole
  27. - os: ubuntu-latest
  28. target: mipsel-unknown-linux-musl
  29. exe: rathole
  30. - os: ubuntu-latest
  31. target: mips64-unknown-linux-gnuabi64
  32. exe: rathole
  33. - os: ubuntu-latest
  34. target: mips64el-unknown-linux-gnuabi64
  35. exe: rathole
  36. - os: macos-latest
  37. target: x86_64-apple-darwin
  38. exe: rathole
  39. - os: windows-latest
  40. target: x86_64-pc-windows-msvc
  41. exe: rathole.exe
  42. steps:
  43. - uses: actions/checkout@v2
  44. - uses: actions-rs/toolchain@v1
  45. with:
  46. profile: minimal
  47. toolchain: stable
  48. - uses: Swatinem/rust-cache@v1
  49. with:
  50. key: ${{ matrix.target }}
  51. - name: Install cross
  52. run: cargo install --version 0.1.16 cross
  53. - name: Run tests
  54. run: cross test --release --target ${{ matrix.target }} --verbose
  55. - name: Build release
  56. run: cross build --release --target ${{ matrix.target }}
  57. - name: Install cargo-strip
  58. run: cargo install cargo-strip
  59. - name: Strip
  60. run: cargo strip --target ${{ matrix.target }}
  61. - name: Run UPX
  62. # Upx may not support some platforms. Ignore the errors
  63. continue-on-error: true
  64. if: matrix.os == 'ubuntu-latest'
  65. uses: crazy-max/ghaction-upx@v1
  66. with:
  67. version: v3.96
  68. files: target/${{ matrix.target }}/release/${{ matrix.exe }}
  69. args: -q --best --lzma
  70. - uses: actions/upload-artifact@v2
  71. with:
  72. name: rathole-${{ matrix.target }}
  73. path: target/${{ matrix.target }}/release/${{ matrix.exe }}
  74. - name: Zip Release
  75. uses: TheDoctor0/zip-release@0.6.0
  76. with:
  77. type: zip
  78. filename: rathole-${{ matrix.target }}.zip
  79. directory: target/${{ matrix.target }}/release/
  80. path: ${{ matrix.exe }}
  81. - name: Publish
  82. uses: softprops/action-gh-release@v1
  83. if: startsWith(github.ref, 'refs/tags/')
  84. with:
  85. files: target/${{ matrix.target }}/release/rathole-${{ matrix.target }}.zip
  86. generate_release_notes: true