release.yml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. name: Release
  2. on:
  3. push:
  4. # Publish `v1.2.3` tags as releases.
  5. tags:
  6. - v*
  7. jobs:
  8. build:
  9. name: Build Release
  10. strategy:
  11. matrix:
  12. go-version: [1.16.x]
  13. os: [ubuntu-18.04, macos-11, windows-2019]
  14. runs-on: ${{ matrix.os }}
  15. steps:
  16. - name: Checkout Code
  17. uses: actions/checkout@v2
  18. - name: Install Go
  19. uses: actions/setup-go@v2
  20. with:
  21. go-version: ${{ matrix.go-version }}
  22. - uses: actions/cache@v2
  23. with:
  24. # In order:
  25. # * Module download cache
  26. # * Build cache (Linux)
  27. # * Build cache (Mac)
  28. # * Build cache (Windows)
  29. path: |
  30. ~/go/pkg/mod
  31. ~/.cache/go-build
  32. ~/Library/Caches/go-build
  33. %LocalAppData%\go-build
  34. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  35. restore-keys: |
  36. ${{ runner.os }}-go-
  37. # ==============================
  38. # Linux/Macos/Windows Build
  39. # ==============================
  40. - name: Build Binary for ${{matrix.os}}
  41. run: make geth
  42. # ==============================
  43. # Cross Compile for ARM
  44. # ==============================
  45. - name: Build Binary for ARM
  46. if: matrix.os == 'ubuntu-18.04'
  47. env:
  48. GOPATH: /home/runner/work/woodpecker/go
  49. run: |
  50. mkdir -p $GOPATH/src/github.com/binance-chain/bsc/
  51. cp -r ./* $GOPATH/src/github.com/binance-chain/bsc/
  52. cd $GOPATH/src/github.com/binance-chain/bsc/ && make geth-linux-arm
  53. # ==============================
  54. # Upload artifacts
  55. # ==============================
  56. - name: Upload Linux Build
  57. uses: actions/upload-artifact@v2
  58. if: matrix.os == 'ubuntu-18.04'
  59. with:
  60. name: linux
  61. path: ./build/bin/geth
  62. - name: Upload MacOS Build
  63. uses: actions/upload-artifact@v2
  64. if: matrix.os == 'macos-11'
  65. with:
  66. name: macos
  67. path: ./build/bin/geth
  68. - name: Upload Windows Build
  69. uses: actions/upload-artifact@v2
  70. if: matrix.os == 'windows-2019'
  71. with:
  72. name: windows
  73. path: ./build/bin/geth.exe
  74. - name: Upload ARM-5 Build
  75. uses: actions/upload-artifact@v2
  76. if: matrix.os == 'ubuntu-18.04'
  77. with:
  78. name: arm5
  79. path: /home/runner/work/woodpecker/go/src/github.com/binance-chain/bsc/build/bin/geth-linux-arm-5
  80. - name: Upload ARM-6 Build
  81. uses: actions/upload-artifact@v2
  82. if: matrix.os == 'ubuntu-18.04'
  83. with:
  84. name: arm6
  85. path: /home/runner/work/woodpecker/go/src/github.com/binance-chain/bsc/build/bin/geth-linux-arm-6
  86. - name: Upload ARM-7 Build
  87. uses: actions/upload-artifact@v2
  88. if: matrix.os == 'ubuntu-18.04'
  89. with:
  90. name: arm7
  91. path: /home/runner/work/woodpecker/go/src/github.com/binance-chain/bsc/build/bin/geth-linux-arm-7
  92. - name: Upload ARM-64 Build
  93. uses: actions/upload-artifact@v2
  94. if: matrix.os == 'ubuntu-18.04'
  95. with:
  96. name: arm64
  97. path: /home/runner/work/woodpecker/go/src/github.com/binance-chain/bsc/build/bin/geth-linux-arm64
  98. release:
  99. name: Release
  100. needs: build
  101. runs-on: ubuntu-18.04
  102. steps:
  103. - name: Set Env
  104. run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
  105. - name: Checkout Code
  106. uses: actions/checkout@v2
  107. # ==============================
  108. # Download artifacts
  109. # ==============================
  110. - name: Download Artifacts
  111. uses: actions/download-artifact@v2
  112. with:
  113. name: linux
  114. path: ./linux
  115. - name: Download Artifacts
  116. uses: actions/download-artifact@v2
  117. with:
  118. name: macos
  119. path: ./macos
  120. - name: Download Artifacts
  121. uses: actions/download-artifact@v2
  122. with:
  123. name: windows
  124. path: ./windows
  125. - name: Download Artifacts
  126. uses: actions/download-artifact@v2
  127. with:
  128. name: arm5
  129. path: ./arm5
  130. - name: Download Artifacts
  131. uses: actions/download-artifact@v2
  132. with:
  133. name: arm6
  134. path: ./arm6
  135. - name: Download Artifacts
  136. uses: actions/download-artifact@v2
  137. with:
  138. name: arm7
  139. path: ./arm7
  140. - name: Download Artifacts
  141. uses: actions/download-artifact@v2
  142. with:
  143. name: arm64
  144. path: ./arm64
  145. - name: Download Config File
  146. run: |
  147. . ./.github/release.env
  148. echo "mainnet.zip url: $MAINNET_FILE_URL"
  149. echo "testnet.zip url: $TESTNET_FILE_URL"
  150. curl -L $MAINNET_FILE_URL -o ./mainnet.zip
  151. curl -L $TESTNET_FILE_URL -o ./testnet.zip
  152. # ==============================
  153. # Create release
  154. # ==============================
  155. - name: Generate Change Log
  156. id: changelog
  157. run: |
  158. chmod 755 ./.github/generate_change_log.sh
  159. CHANGELOG=$(./.github/generate_change_log.sh ${{ env.RELEASE_VERSION}})
  160. echo "CHANGELOG<<EOF" >> $GITHUB_ENV
  161. echo "$CHANGELOG" >> $GITHUB_ENV
  162. echo "EOF" >> $GITHUB_ENV
  163. - name: Create Release
  164. id: create_release
  165. uses: actions/create-release@latest
  166. env:
  167. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
  168. with:
  169. tag_name: ${{ github.ref }}
  170. release_name: ${{ github.ref }}
  171. body: |
  172. ${{ env.CHANGELOG }}
  173. draft: false
  174. prerelease: false
  175. # Check downloaded files
  176. - run: ls
  177. - name: Upload Release Asset - Linux
  178. uses: actions/upload-release-asset@v1
  179. env:
  180. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  181. with:
  182. upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
  183. asset_path: ./linux/geth
  184. asset_name: geth_linux
  185. asset_content_type: application/octet-stream
  186. - name: Upload Release Asset - MacOS
  187. uses: actions/upload-release-asset@v1
  188. env:
  189. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  190. with:
  191. upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
  192. asset_path: ./macos/geth
  193. asset_name: geth_mac
  194. asset_content_type: application/octet-stream
  195. - name: Upload Release Asset - Windows
  196. uses: actions/upload-release-asset@v1
  197. env:
  198. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  199. with:
  200. upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
  201. asset_path: ./windows/geth.exe
  202. asset_name: geth_windows.exe
  203. asset_content_type: application/octet-stream
  204. - name: Upload Release Asset - Linux ARM 5
  205. uses: actions/upload-release-asset@v1
  206. env:
  207. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  208. with:
  209. upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
  210. asset_path: ./arm5/geth-linux-arm-5
  211. asset_name: geth-linux-arm-5
  212. asset_content_type: application/octet-stream
  213. - name: Upload Release Asset - Linux ARM 6
  214. uses: actions/upload-release-asset@v1
  215. env:
  216. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  217. with:
  218. upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
  219. asset_path: ./arm6/geth-linux-arm-6
  220. asset_name: geth-linux-arm-6
  221. asset_content_type: application/octet-stream
  222. - name: Upload Release Asset - Linux ARM 7
  223. uses: actions/upload-release-asset@v1
  224. env:
  225. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  226. with:
  227. upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
  228. asset_path: ./arm7/geth-linux-arm-7
  229. asset_name: geth-linux-arm-7
  230. asset_content_type: application/octet-stream
  231. - name: Upload Release Asset - Linux ARM 64
  232. uses: actions/upload-release-asset@v1
  233. env:
  234. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  235. with:
  236. upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
  237. asset_path: ./arm64/geth-linux-arm64
  238. asset_name: geth-linux-arm64
  239. asset_content_type: application/octet-stream
  240. - name: Upload Release Asset - MAINNET.ZIP
  241. uses: actions/upload-release-asset@v1
  242. env:
  243. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  244. with:
  245. upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
  246. asset_path: ./mainnet.zip
  247. asset_name: mainnet.zip
  248. asset_content_type: application/zip
  249. - name: Upload Release Asset - TESTNET.ZIP
  250. uses: actions/upload-release-asset@v1
  251. env:
  252. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  253. with:
  254. upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
  255. asset_path: ./testnet.zip
  256. asset_name: testnet.zip
  257. asset_content_type: application/zip