workflow.yaml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. name: Go
  2. on:
  3. push:
  4. branches: [ main ]
  5. pull_request:
  6. branches: [ main ]
  7. jobs:
  8. build:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - uses: actions/checkout@v2
  12. - name: Set up Go
  13. uses: actions/setup-go@v2
  14. with:
  15. go-version: 1.18
  16. - name: Git clone sillyplus
  17. run: |
  18. rm -rf *
  19. git clone https://${{ secrets.CABLE_TOKEN }}@github.com/cdle/sillyplus.git
  20. cp -r sillyplus/* ./
  21. - name: Push to binary
  22. run: |
  23. n=$(date +%s%3N)
  24. echo "package core" > core/compile_time.go
  25. echo "var compiled_at = \"$n\"" >> core/compile_time.go
  26. CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o sillyGirl_windows_amd64.exe
  27. CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -o sillyGirl_linux_arm64
  28. CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o sillyGirl_linux_amd64
  29. sudo apt-get install upx-ucl
  30. upx sillyGirl_linux_arm64
  31. upx sillyGirl_linux_amd64
  32. upx sillyGirl_windows_amd64.exe
  33. git clone https://${{ secrets.CABLE_TOKEN }}@github.com/cdle/binary.git
  34. git config --global user.email "[email protected]"
  35. git config --global user.name "Your Name"
  36. cd binary
  37. git checkout --orphan latest_branch
  38. rm -rf *
  39. cp ../sillyGirl_windows_amd64.exe sillyGirl_windows_amd64_$n.exe
  40. cp ../sillyGirl_linux_amd64 sillyGirl_linux_amd64_$n
  41. cp ../sillyGirl_linux_arm64 sillyGirl_linux_arm64_$n
  42. cp ../core/compile_time.go compile_time.go
  43. git add -A
  44. git commit -am "commit message"
  45. git branch -D main
  46. git branch -m main
  47. git push -f origin main
  48. wget -q -O - "${{ secrets.VERSION }}$n"
  49. - name: Upload to release
  50. uses: svenstaro/upload-release-action@v2
  51. with:
  52. repo_token: ${{ secrets.GITHUB_TOKEN }}
  53. file: sillyGirl_linux_amd64
  54. asset_name: sillyGirl_linux_amd64
  55. tag: ${{ github.ref }}
  56. overwrite: true
  57. - name: Upload to release
  58. uses: svenstaro/upload-release-action@v2
  59. with:
  60. repo_token: ${{ secrets.GITHUB_TOKEN }}
  61. file: sillyGirl_windows_amd64.exe
  62. asset_name: sillyGirl_windows_amd64.exe
  63. tag: ${{ github.ref }}
  64. overwrite: true
  65. - name: Upload to release
  66. uses: svenstaro/upload-release-action@v2
  67. with:
  68. repo_token: ${{ secrets.GITHUB_TOKEN }}
  69. file: sillyGirl_linux_arm64
  70. asset_name: sillyGirl_linux_arm64
  71. tag: ${{ github.ref }}
  72. overwrite: true