release.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. name: build
  2. on:
  3. push:
  4. branches: [master]
  5. tags: ['v*']
  6. pull_request:
  7. workflow_dispatch:
  8. jobs:
  9. build:
  10. strategy:
  11. fail-fast: false
  12. matrix:
  13. include:
  14. - os: ubuntu-latest
  15. rid: linux-x64
  16. - os: windows-latest
  17. rid: win-x64
  18. runs-on: ${{ matrix.os }}
  19. steps:
  20. - uses: actions/checkout@v7
  21. - uses: actions/setup-dotnet@v5
  22. with:
  23. dotnet-version: 8.0.x
  24. - run: dotnet publish -c Release -r ${{ matrix.rid }} --self-contained -o publish
  25. - name: Package tarball
  26. if: runner.os == 'Linux'
  27. run: tar -czf SLAM-Cross-${{ matrix.rid }}.tar.gz -C publish .
  28. - name: Build AppImage
  29. if: runner.os == 'Linux'
  30. run: sh packaging/build-appimage.sh
  31. - name: Build deb and rpm
  32. if: runner.os == 'Linux'
  33. run: |
  34. v=0.0.0
  35. case "$GITHUB_REF" in refs/tags/v*) v=${GITHUB_REF_NAME#v} ;; esac
  36. curl -sfL https://github.com/goreleaser/nfpm/releases/download/v2.47.0/nfpm_2.47.0_Linux_x86_64.tar.gz | tar xz nfpm
  37. VERSION=$v ./nfpm package -f packaging/nfpm.yaml -p deb
  38. VERSION=$v ./nfpm package -f packaging/nfpm.yaml -p rpm
  39. - name: Package zip
  40. if: runner.os == 'Windows'
  41. run: Compress-Archive -Path publish/* -DestinationPath SLAM-Cross-${{ matrix.rid }}.zip
  42. - uses: actions/upload-artifact@v7
  43. with:
  44. name: SLAM-Cross-${{ matrix.rid }}
  45. path: |
  46. SLAM-Cross-*.tar.gz
  47. SLAM-Cross-*.zip
  48. SLAM-Cross-*.AppImage
  49. slam-cross*.deb
  50. slam-cross*.rpm
  51. release:
  52. if: startsWith(github.ref, 'refs/tags/v')
  53. needs: build
  54. runs-on: ubuntu-latest
  55. permissions:
  56. contents: write
  57. steps:
  58. - uses: actions/download-artifact@v8
  59. with:
  60. merge-multiple: true
  61. - name: Create release
  62. env:
  63. GH_TOKEN: ${{ github.token }}
  64. run: >
  65. gh release create ${{ github.ref_name }}
  66. SLAM-Cross-linux-x64.tar.gz SLAM-Cross-win-x64.zip
  67. SLAM-Cross-x86_64.AppImage slam-cross*.deb slam-cross*.rpm
  68. --repo ${{ github.repository }}
  69. --title ${{ github.ref_name }}
  70. --generate-notes