release.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: Release
  2. on:
  3. push:
  4. tags:
  5. - "*"
  6. jobs:
  7. build:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout
  11. uses: actions/checkout@v3
  12. - name: Cache Build
  13. id: cache-build
  14. uses: actions/cache@v3
  15. with:
  16. path: target
  17. key: ${{ runner.os }}-build
  18. - name: Cargo Test
  19. run: |
  20. cargo test
  21. - name: Cargo Clippy
  22. run: |
  23. cargo clippy -- -W clippy::pedantic -W clippy::nursery -W clippy::unwrap_used
  24. - name: Cargo Build Binary
  25. run: |
  26. cd rust
  27. cargo build --release
  28. chmod +x target/release/${{ github.event.repository.name }}
  29. - name: Optimize Binary with UPX
  30. run: |
  31. upx --best --lzma target/release/${{ github.event.repository.name }}
  32. - name: Package Binary
  33. run: |
  34. toolchain=$(rustup toolchain list | awk '{print $1;}')
  35. tar_name="${{ github.event.repository.name }}_${{ github.ref_name }}-$toolchain"
  36. tar -cvzf target/release/$tar_name.tar.gz target/release/${{ github.event.repository.name }}
  37. - name: Release
  38. uses: docker://antonyurchenko/git-release:v5
  39. env:
  40. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  41. RELEASE_NAME_PREFIX: "Release "
  42. CHANGELOG_FILE: none
  43. with:
  44. args: |
  45. target/release/*.tar.gz