release.yml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. name: Release (Linux, macOS, Windows)
  2. permissions:
  3. contents: write
  4. on:
  5. workflow_dispatch:
  6. inputs:
  7. name:
  8. description: 'reason'
  9. required: false
  10. push:
  11. tags:
  12. - '*'
  13. - '!*-alpha*'
  14. jobs:
  15. linux:
  16. name: Linux Release
  17. runs-on: ubuntu-latest
  18. steps:
  19. - name: Checkout
  20. uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
  21. with:
  22. fetch-depth: 0
  23. - name: Determine Version
  24. run: |
  25. VERSION=$(git describe --tags)
  26. echo "VERSION=$VERSION" >> $GITHUB_ENV
  27. - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
  28. with:
  29. bun-version: latest
  30. - name: Build Frontend (default)
  31. env:
  32. CI: ""
  33. run: |
  34. cd web/default
  35. bun install
  36. DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$VERSION bun run build
  37. cd ../..
  38. - name: Build Frontend (classic)
  39. env:
  40. CI: ""
  41. run: |
  42. cd web/classic
  43. bun install
  44. VITE_REACT_APP_VERSION=$VERSION bun run build
  45. cd ../..
  46. - name: Set up Go
  47. uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
  48. with:
  49. go-version: '>=1.25.1'
  50. - name: Build Backend (amd64)
  51. run: |
  52. go mod download
  53. go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-$VERSION
  54. - name: Build Backend (arm64)
  55. run: |
  56. sudo apt-get update
  57. DEBIAN_FRONTEND=noninteractive sudo apt-get install -y gcc-aarch64-linux-gnu
  58. CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION' -extldflags '-static'" -o new-api-arm64-$VERSION
  59. - name: Generate checksums
  60. run: sha256sum new-api-* > checksums-linux.txt
  61. - name: Release
  62. uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
  63. if: startsWith(github.ref, 'refs/tags/')
  64. with:
  65. files: |
  66. new-api-*
  67. checksums-linux.txt
  68. env:
  69. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  70. macos:
  71. name: macOS Release
  72. runs-on: macos-latest
  73. steps:
  74. - name: Checkout
  75. uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
  76. with:
  77. fetch-depth: 0
  78. - name: Determine Version
  79. run: |
  80. VERSION=$(git describe --tags)
  81. echo "VERSION=$VERSION" >> $GITHUB_ENV
  82. - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
  83. with:
  84. bun-version: latest
  85. - name: Build Frontend (default)
  86. env:
  87. CI: ""
  88. NODE_OPTIONS: "--max-old-space-size=4096"
  89. run: |
  90. cd web/default
  91. bun install
  92. DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$VERSION bun run build
  93. cd ../..
  94. - name: Build Frontend (classic)
  95. env:
  96. CI: ""
  97. run: |
  98. cd web/classic
  99. bun install
  100. VITE_REACT_APP_VERSION=$VERSION bun run build
  101. cd ../..
  102. - name: Set up Go
  103. uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
  104. with:
  105. go-version: '>=1.25.1'
  106. - name: Build Backend
  107. run: |
  108. go mod download
  109. go build -ldflags "-X 'new-api/common.Version=$VERSION'" -o new-api-macos-$VERSION
  110. - name: Generate checksums
  111. run: shasum -a 256 new-api-macos-* > checksums-macos.txt
  112. - name: Release
  113. uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
  114. if: startsWith(github.ref, 'refs/tags/')
  115. with:
  116. files: |
  117. new-api-macos-*
  118. checksums-macos.txt
  119. env:
  120. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  121. windows:
  122. name: Windows Release
  123. runs-on: windows-latest
  124. defaults:
  125. run:
  126. shell: bash
  127. steps:
  128. - name: Checkout
  129. uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
  130. with:
  131. fetch-depth: 0
  132. - name: Determine Version
  133. run: |
  134. VERSION=$(git describe --tags)
  135. echo "VERSION=$VERSION" >> $GITHUB_ENV
  136. - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
  137. with:
  138. bun-version: latest
  139. - name: Build Frontend (default)
  140. env:
  141. CI: ""
  142. run: |
  143. cd web/default
  144. bun install
  145. DISABLE_ESLINT_PLUGIN='true' VITE_REACT_APP_VERSION=$VERSION bun run build
  146. cd ../..
  147. - name: Build Frontend (classic)
  148. env:
  149. CI: ""
  150. run: |
  151. cd web/classic
  152. bun install
  153. VITE_REACT_APP_VERSION=$VERSION bun run build
  154. cd ../..
  155. - name: Set up Go
  156. uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
  157. with:
  158. go-version: '>=1.25.1'
  159. - name: Build Backend
  160. run: |
  161. go mod download
  162. go build -ldflags "-s -w -X 'new-api/common.Version=$VERSION'" -o new-api-$VERSION.exe
  163. - name: Generate checksums
  164. run: sha256sum new-api-*.exe > checksums-windows.txt
  165. - name: Release
  166. uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2
  167. if: startsWith(github.ref, 'refs/tags/')
  168. with:
  169. files: |
  170. new-api-*.exe
  171. checksums-windows.txt
  172. env:
  173. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}