pre-release.yml 11 KB

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