release.yml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. on:
  2. push:
  3. tags:
  4. - 'v[0-9]+.[0-9]+.[0-9]*'
  5. name: Create release and upload binaries
  6. jobs:
  7. build-linux:
  8. name: Build Linux All
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Set up Go 1.15
  12. uses: actions/setup-go@v1
  13. with:
  14. go-version: 1.15
  15. - name: Checkout code
  16. uses: actions/checkout@v2
  17. - name: Build
  18. run: |
  19. make BUILD_NUMBER="${GITHUB_REF#refs/tags/v}" release-linux release-freebsd
  20. mkdir release
  21. mv build/*.tar.gz release
  22. - name: Upload artifacts
  23. uses: actions/upload-artifact@v1
  24. with:
  25. name: linux-latest
  26. path: release
  27. build-windows:
  28. name: Build Windows amd64
  29. runs-on: windows-latest
  30. steps:
  31. - name: Set up Go 1.15
  32. uses: actions/setup-go@v1
  33. with:
  34. go-version: 1.15
  35. - name: Checkout code
  36. uses: actions/checkout@v2
  37. - name: Build
  38. run: |
  39. echo $Env:GITHUB_REF.Substring(11)
  40. go build -trimpath -ldflags "-X main.Build=$($Env:GITHUB_REF.Substring(11))" -o build\nebula.exe ./cmd/nebula-service
  41. go build -trimpath -ldflags "-X main.Build=$($Env:GITHUB_REF.Substring(11))" -o build\nebula-cert.exe ./cmd/nebula-cert
  42. - name: Upload artifacts
  43. uses: actions/upload-artifact@v1
  44. with:
  45. name: windows-latest
  46. path: build
  47. build-darwin:
  48. name: Build Darwin amd64
  49. runs-on: macOS-latest
  50. steps:
  51. - name: Set up Go 1.15
  52. uses: actions/setup-go@v1
  53. with:
  54. go-version: 1.15
  55. - name: Checkout code
  56. uses: actions/checkout@v2
  57. - name: Build
  58. run: |
  59. make BUILD_NUMBER="${GITHUB_REF#refs/tags/v}" service build/nebula-darwin-amd64.tar.gz
  60. mkdir release
  61. mv build/*.tar.gz release
  62. - name: Upload artifacts
  63. uses: actions/upload-artifact@v1
  64. with:
  65. name: darwin-latest
  66. path: release
  67. release:
  68. name: Create and Upload Release
  69. needs: [build-linux, build-darwin, build-windows]
  70. runs-on: ubuntu-latest
  71. steps:
  72. - name: Download Linux artifacts
  73. uses: actions/download-artifact@v1
  74. with:
  75. name: linux-latest
  76. - name: Download Darwin artifacts
  77. uses: actions/download-artifact@v1
  78. with:
  79. name: darwin-latest
  80. - name: Download Windows artifacts
  81. uses: actions/download-artifact@v1
  82. with:
  83. name: windows-latest
  84. - name: Zip Windows
  85. run: |
  86. cd windows-latest
  87. zip nebula-windows-amd64.zip nebula.exe nebula-cert.exe
  88. - name: Create sha256sum
  89. run: |
  90. for dir in linux-latest darwin-latest windows-latest
  91. do
  92. (
  93. cd $dir
  94. if [ "$dir" = windows-latest ]
  95. then
  96. sha256sum <nebula.exe | sed 's=-$=nebula-windows-amd64.zip/nebula.exe='
  97. sha256sum <nebula-cert.exe | sed 's=-$=nebula-windows-amd64.zip/nebula-cert.exe='
  98. sha256sum nebula-windows-amd64.zip
  99. else
  100. for v in *.tar.gz
  101. do
  102. sha256sum $v
  103. tar zxf $v --to-command='sh -c "sha256sum | sed s=-$='$v'/$TAR_FILENAME="'
  104. done
  105. fi
  106. )
  107. done | sort -k 2 >SHASUM256.txt
  108. - name: Create Release
  109. id: create_release
  110. uses: actions/create-release@v1
  111. env:
  112. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  113. with:
  114. tag_name: ${{ github.ref }}
  115. release_name: Release ${{ github.ref }}
  116. draft: false
  117. prerelease: false
  118. ##
  119. ## Upload assets (I wish we could just upload the whole folder at once...
  120. ##
  121. - name: Upload SHASUM256.txt
  122. uses: actions/[email protected]
  123. env:
  124. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  125. with:
  126. upload_url: ${{ steps.create_release.outputs.upload_url }}
  127. asset_path: ./SHASUM256.txt
  128. asset_name: SHASUM256.txt
  129. asset_content_type: text/plain
  130. - name: Upload darwin-amd64
  131. uses: actions/[email protected]
  132. env:
  133. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  134. with:
  135. upload_url: ${{ steps.create_release.outputs.upload_url }}
  136. asset_path: ./darwin-latest/nebula-darwin-amd64.tar.gz
  137. asset_name: nebula-darwin-amd64.tar.gz
  138. asset_content_type: application/gzip
  139. - name: Upload windows-amd64
  140. uses: actions/[email protected]
  141. env:
  142. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  143. with:
  144. upload_url: ${{ steps.create_release.outputs.upload_url }}
  145. asset_path: ./windows-latest/nebula-windows-amd64.zip
  146. asset_name: nebula-windows-amd64.zip
  147. asset_content_type: application/zip
  148. - name: Upload linux-amd64
  149. uses: actions/[email protected]
  150. env:
  151. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  152. with:
  153. upload_url: ${{ steps.create_release.outputs.upload_url }}
  154. asset_path: ./linux-latest/nebula-linux-amd64.tar.gz
  155. asset_name: nebula-linux-amd64.tar.gz
  156. asset_content_type: application/gzip
  157. - name: Upload linux-386
  158. uses: actions/[email protected]
  159. env:
  160. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  161. with:
  162. upload_url: ${{ steps.create_release.outputs.upload_url }}
  163. asset_path: ./linux-latest/nebula-linux-386.tar.gz
  164. asset_name: nebula-linux-386.tar.gz
  165. asset_content_type: application/gzip
  166. - name: Upload linux-ppc64le
  167. uses: actions/[email protected]
  168. env:
  169. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  170. with:
  171. upload_url: ${{ steps.create_release.outputs.upload_url }}
  172. asset_path: ./linux-latest/nebula-linux-ppc64le.tar.gz
  173. asset_name: nebula-linux-ppc64le.tar.gz
  174. asset_content_type: application/gzip
  175. - name: Upload linux-arm-5
  176. uses: actions/[email protected]
  177. env:
  178. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  179. with:
  180. upload_url: ${{ steps.create_release.outputs.upload_url }}
  181. asset_path: ./linux-latest/nebula-linux-arm-5.tar.gz
  182. asset_name: nebula-linux-arm-5.tar.gz
  183. asset_content_type: application/gzip
  184. - name: Upload linux-arm-6
  185. uses: actions/[email protected]
  186. env:
  187. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  188. with:
  189. upload_url: ${{ steps.create_release.outputs.upload_url }}
  190. asset_path: ./linux-latest/nebula-linux-arm-6.tar.gz
  191. asset_name: nebula-linux-arm-6.tar.gz
  192. asset_content_type: application/gzip
  193. - name: Upload linux-arm-7
  194. uses: actions/[email protected]
  195. env:
  196. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  197. with:
  198. upload_url: ${{ steps.create_release.outputs.upload_url }}
  199. asset_path: ./linux-latest/nebula-linux-arm-7.tar.gz
  200. asset_name: nebula-linux-arm-7.tar.gz
  201. asset_content_type: application/gzip
  202. - name: Upload linux-arm64
  203. uses: actions/[email protected]
  204. env:
  205. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  206. with:
  207. upload_url: ${{ steps.create_release.outputs.upload_url }}
  208. asset_path: ./linux-latest/nebula-linux-arm64.tar.gz
  209. asset_name: nebula-linux-arm64.tar.gz
  210. asset_content_type: application/gzip
  211. - name: Upload linux-mips
  212. uses: actions/[email protected]
  213. env:
  214. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  215. with:
  216. upload_url: ${{ steps.create_release.outputs.upload_url }}
  217. asset_path: ./linux-latest/nebula-linux-mips.tar.gz
  218. asset_name: nebula-linux-mips.tar.gz
  219. asset_content_type: application/gzip
  220. - name: Upload linux-mipsle
  221. uses: actions/[email protected]
  222. env:
  223. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  224. with:
  225. upload_url: ${{ steps.create_release.outputs.upload_url }}
  226. asset_path: ./linux-latest/nebula-linux-mipsle.tar.gz
  227. asset_name: nebula-linux-mipsle.tar.gz
  228. asset_content_type: application/gzip
  229. - name: Upload linux-mips64
  230. uses: actions/[email protected]
  231. env:
  232. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  233. with:
  234. upload_url: ${{ steps.create_release.outputs.upload_url }}
  235. asset_path: ./linux-latest/nebula-linux-mips64.tar.gz
  236. asset_name: nebula-linux-mips64.tar.gz
  237. asset_content_type: application/gzip
  238. - name: Upload linux-mips64le
  239. uses: actions/[email protected]
  240. env:
  241. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  242. with:
  243. upload_url: ${{ steps.create_release.outputs.upload_url }}
  244. asset_path: ./linux-latest/nebula-linux-mips64le.tar.gz
  245. asset_name: nebula-linux-mips64le.tar.gz
  246. asset_content_type: application/gzip
  247. - name: Upload linux-mips-softfloat
  248. uses: actions/[email protected]
  249. env:
  250. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  251. with:
  252. upload_url: ${{ steps.create_release.outputs.upload_url }}
  253. asset_path: ./linux-latest/nebula-linux-mips-softfloat.tar.gz
  254. asset_name: nebula-linux-mips-softfloat.tar.gz
  255. asset_content_type: application/gzip
  256. - name: Upload freebsd-amd64
  257. uses: actions/[email protected]
  258. env:
  259. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  260. with:
  261. upload_url: ${{ steps.create_release.outputs.upload_url }}
  262. asset_path: ./linux-latest/nebula-freebsd-amd64.tar.gz
  263. asset_name: nebula-freebsd-amd64.tar.gz
  264. asset_content_type: application/gzip