release.yml 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. name: Release 3X-ui
  2. on:
  3. push:
  4. tags:
  5. - "*"
  6. workflow_dispatch:
  7. jobs:
  8. build:
  9. strategy:
  10. matrix:
  11. platform: [amd64, arm64, arm]
  12. runs-on: ubuntu-20.04
  13. steps:
  14. - name: Checkout repository
  15. uses: actions/[email protected]
  16. - name: Setup Go
  17. uses: actions/[email protected]
  18. with:
  19. go-version: '1.21'
  20. - name: Install dependencies for arm64 and arm
  21. if: matrix.platform == 'arm64' || matrix.platform == 'arm'
  22. run: |
  23. sudo apt-get update
  24. sudo apt install gcc-aarch64-linux-gnu
  25. if [ "${{ matrix.platform }}" == "arm" ]; then
  26. sudo apt install gcc-arm-linux-gnueabihf
  27. fi
  28. - name: Build x-ui
  29. run: |
  30. export CGO_ENABLED=1
  31. export GOOS=linux
  32. export GOARCH=${{ matrix.platform }}
  33. if [ "${{ matrix.platform }}" == "arm64" ]; then
  34. export CC=aarch64-linux-gnu-gcc
  35. elif [ "${{ matrix.platform }}" == "arm" ]; then
  36. export CC=arm-linux-gnueabihf-gcc
  37. fi
  38. go build -o xui-release -v main.go
  39. mkdir x-ui
  40. cp xui-release x-ui/
  41. cp x-ui.service x-ui/
  42. cp x-ui.sh x-ui/
  43. mv x-ui/xui-release x-ui/x-ui
  44. mkdir x-ui/bin
  45. cd x-ui/bin
  46. # Download dependencies
  47. if [ "${{ matrix.platform }}" == "amd64" ]; then
  48. wget https://github.com/XTLS/Xray-core/releases/download/v1.8.7/Xray-linux-64.zip
  49. unzip Xray-linux-64.zip
  50. rm -f Xray-linux-64.zip
  51. elif [ "${{ matrix.platform }}" == "arm64" ]; then
  52. wget https://github.com/XTLS/Xray-core/releases/download/v1.8.7/Xray-linux-arm64-v8a.zip
  53. unzip Xray-linux-arm64-v8a.zip
  54. rm -f Xray-linux-arm64-v8a.zip
  55. else
  56. wget https://github.com/XTLS/Xray-core/releases/download/v1.8.7/Xray-linux-arm32-v7a.zip
  57. unzip Xray-linux-arm32-v7a.zip
  58. rm -f Xray-linux-arm32-v7a.zip
  59. fi
  60. rm -f geoip.dat geosite.dat geoip_IR.dat geosite_IR.dat geoip_VN.dat geosite_VN.dat
  61. wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
  62. wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
  63. wget -O geoip_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
  64. wget -O geosite_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
  65. wget -O geoip_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geoip.dat
  66. wget -O geosite_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geosite.dat
  67. mv xray xray-linux-${{ matrix.platform }}
  68. cd ../..
  69. - name: Package
  70. run: tar -zcvf x-ui-linux-${{ matrix.platform }}.tar.gz x-ui
  71. - name: Upload
  72. uses: svenstaro/[email protected]
  73. with:
  74. repo_token: ${{ secrets.GITHUB_TOKEN }}
  75. tag: ${{ github.ref }}
  76. file: x-ui-linux-${{ matrix.platform }}.tar.gz
  77. asset_name: x-ui-linux-${{ matrix.platform }}.tar.gz
  78. prerelease: true
  79. overwrite: true