release.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. name: Release
  2. on:
  3. release:
  4. types: [published]
  5. branches: [ master ]
  6. jobs:
  7. build_assets:
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Set up Go 1.x
  11. uses: actions/setup-go@v2
  12. with:
  13. go-version: 1.15
  14. id: go
  15. - name: Check out code into the Go module directory
  16. uses: actions/checkout@v2
  17. - name: Get dependencies
  18. run: |
  19. go get -v -t -d ./...
  20. if [ -f Gopkg.toml ]; then
  21. curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
  22. dep ensure
  23. fi
  24. - name: Build
  25. run: |
  26. chmod +x build.assets.sh
  27. ./build.assets.sh
  28. - name: Upload
  29. uses: softprops/action-gh-release@v1
  30. if: startsWith(github.ref, 'refs/tags/')
  31. with:
  32. files: |
  33. freebsd_386_client.tar.gz
  34. freebsd_386_server.tar.gz
  35. freebsd_amd64_client.tar.gz
  36. freebsd_amd64_server.tar.gz
  37. freebsd_arm_client.tar.gz
  38. freebsd_arm_server.tar.gz
  39. linux_386_client.tar.gz
  40. linux_386_server.tar.gz
  41. linux_amd64_client.tar.gz
  42. linux_amd64_server.tar.gz
  43. linux_arm64_client.tar.gz
  44. linux_arm64_server.tar.gz
  45. linux_arm_v5_client.tar.gz
  46. linux_arm_v6_client.tar.gz
  47. linux_arm_v7_client.tar.gz
  48. linux_arm_v5_server.tar.gz
  49. linux_arm_v6_server.tar.gz
  50. linux_arm_v7_server.tar.gz
  51. linux_mips64le_client.tar.gz
  52. linux_mips64le_server.tar.gz
  53. linux_mips64_client.tar.gz
  54. linux_mips64_server.tar.gz
  55. linux_mipsle_client.tar.gz
  56. linux_mipsle_server.tar.gz
  57. linux_mips_client.tar.gz
  58. linux_mips_server.tar.gz
  59. darwin_amd64_client.tar.gz
  60. darwin_amd64_server.tar.gz
  61. windows_386_client.tar.gz
  62. windows_386_server.tar.gz
  63. windows_amd64_client.tar.gz
  64. windows_amd64_server.tar.gz
  65. npc_sdk.tar.gz
  66. env:
  67. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  68. build_android:
  69. runs-on: ubuntu-latest
  70. steps:
  71. - name: Check out code into the Go module directory
  72. uses: actions/checkout@v2
  73. - name: Build
  74. run: |
  75. chmod +x build.android.sh
  76. docker run --rm -i -w /app -v $(pwd):/app -e ANDROID_HOME=/usr/local/android_sdk -e GOPROXY=direct fyneio/fyne-cross:android-latest /app/build.android.sh
  77. - name: Upload
  78. uses: softprops/action-gh-release@v1
  79. if: startsWith(github.ref, 'refs/tags/')
  80. with:
  81. files: |
  82. android_client.apk
  83. env:
  84. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  85. build_spk:
  86. runs-on: ubuntu-latest
  87. steps:
  88. - name: Check out code into the Go module directory
  89. uses: actions/checkout@v2
  90. - name: Set env
  91. run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
  92. - name: Build
  93. run: |
  94. git clone https://github.com/cnlh/spksrc.git ~/spksrc
  95. mkdir ~/spksrc/nps && cp -rf ./* ~/spksrc/nps/
  96. docker run -id --name spksrc --env VERSION=${{ env.RELEASE_VERSION }} -e GOPROXY=direct -v ~/spksrc:/spksrc synocommunity/spksrc /bin/bash
  97. docker exec spksrc /bin/bash -c 'cd /spksrc && make setup && cd /spksrc/spk/npc && make'
  98. cp ~/spksrc/packages/npc_noarch-all_${{ env.RELEASE_VERSION }}-1.spk ./npc_syno.spk
  99. - name: Upload
  100. uses: softprops/action-gh-release@v1
  101. if: startsWith(github.ref, 'refs/tags/')
  102. with:
  103. files: |
  104. npc_syno.spk
  105. env:
  106. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  107. build_docker:
  108. runs-on: ubuntu-latest
  109. steps:
  110. - name: Check out code into the Go module directory
  111. uses: actions/checkout@v2
  112. - name: Set env
  113. run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
  114. - name: Set up QEMU
  115. uses: docker/setup-qemu-action@v1
  116. - name: Set up Docker Buildx
  117. uses: docker/setup-buildx-action@v1
  118. - name: Cache Docker layers
  119. uses: actions/cache@v2
  120. with:
  121. path: /tmp/.buildx-cache
  122. key: ${{ runner.os }}-buildx-${{ github.sha }}
  123. restore-keys: |
  124. ${{ runner.os }}-buildx-
  125. - name: Login to DockerHub
  126. uses: docker/login-action@v1
  127. with:
  128. username: ${{ secrets.DOCKERHUB_USERNAME }}
  129. password: ${{ secrets.DOCKERHUB_TOKEN }}
  130. - name: Build and push nps
  131. uses: docker/build-push-action@v2
  132. with:
  133. context: .
  134. file: ./Dockerfile.nps
  135. platforms: linux/amd64,linux/arm,linux/arm64
  136. push: true
  137. tags: |
  138. ${{ secrets.DOCKERHUB_USERNAME }}/nps:latest
  139. ${{ secrets.DOCKERHUB_USERNAME }}/nps:${{ env.RELEASE_VERSION }}
  140. - name: Build and push npc
  141. uses: docker/build-push-action@v2
  142. with:
  143. context: .
  144. file: ./Dockerfile.npc
  145. platforms: linux/amd64,linux/arm,linux/arm64
  146. push: true
  147. tags: |
  148. ${{ secrets.DOCKERHUB_USERNAME }}/npc:latest
  149. ${{ secrets.DOCKERHUB_USERNAME }}/npc:${{ env.RELEASE_VERSION }}