release.yml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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:
  12. - amd64
  13. - arm64
  14. - armv7
  15. - armv6
  16. - 386
  17. - armv5
  18. runs-on: ubuntu-20.04
  19. steps:
  20. - name: Checkout repository
  21. uses: actions/checkout@v4
  22. - name: Setup Go
  23. uses: actions/setup-go@v5
  24. with:
  25. go-version: '1.22'
  26. - name: Install dependencies
  27. run: |
  28. sudo apt-get update
  29. if [ "${{ matrix.platform }}" == "arm64" ]; then
  30. sudo apt install gcc-aarch64-linux-gnu
  31. elif [ "${{ matrix.platform }}" == "armv7" ]; then
  32. sudo apt install gcc-arm-linux-gnueabihf
  33. elif [ "${{ matrix.platform }}" == "armv6" ]; then
  34. sudo apt install gcc-arm-linux-gnueabihf
  35. elif [ "${{ matrix.platform }}" == "386" ]; then
  36. sudo apt install gcc-i686-linux-gnu
  37. elif [ "${{ matrix.platform }}" == "armv5" ]; then
  38. sudo apt install gcc-arm-linux-gnueabi
  39. fi
  40. - name: Build x-ui
  41. run: |
  42. export CGO_ENABLED=1
  43. export GOOS=linux
  44. export GOARCH=${{ matrix.platform }}
  45. if [ "${{ matrix.platform }}" == "arm64" ]; then
  46. export GOARCH=arm64
  47. export CC=aarch64-linux-gnu-gcc
  48. elif [ "${{ matrix.platform }}" == "armv7" ]; then
  49. export GOARCH=arm
  50. export GOARM=7
  51. export CC=arm-linux-gnueabihf-gcc
  52. elif [ "${{ matrix.platform }}" == "armv6" ]; then
  53. export GOARCH=arm
  54. export GOARM=6
  55. export CC=arm-linux-gnueabihf-gcc
  56. elif [ "${{ matrix.platform }}" == "386" ]; then
  57. export GOARCH=386
  58. export CC=i686-linux-gnu-gcc
  59. elif [ "${{ matrix.platform }}" == "armv5" ]; then
  60. export GOARCH=arm
  61. export GOARM=5
  62. export CC=arm-linux-gnueabi-gcc
  63. fi
  64. go build -o xui-release -v main.go
  65. mkdir x-ui
  66. cp xui-release x-ui/
  67. cp x-ui.service x-ui/
  68. cp x-ui.sh x-ui/
  69. mv x-ui/xui-release x-ui/x-ui
  70. mkdir x-ui/bin
  71. cd x-ui/bin
  72. # Download dependencies
  73. Xray_URL="https://github.com/XTLS/Xray-core/releases/download/v1.8.9/"
  74. if [ "${{ matrix.platform }}" == "amd64" ]; then
  75. wget ${Xray_URL}Xray-linux-64.zip
  76. unzip Xray-linux-64.zip
  77. rm -f Xray-linux-64.zip
  78. elif [ "${{ matrix.platform }}" == "arm64" ]; then
  79. wget ${Xray_URL}Xray-linux-arm64-v8a.zip
  80. unzip Xray-linux-arm64-v8a.zip
  81. rm -f Xray-linux-arm64-v8a.zip
  82. elif [ "${{ matrix.platform }}" == "armv7" ]; then
  83. wget ${Xray_URL}Xray-linux-arm32-v7a.zip
  84. unzip Xray-linux-arm32-v7a.zip
  85. rm -f Xray-linux-arm32-v7a.zip
  86. elif [ "${{ matrix.platform }}" == "armv6" ]; then
  87. wget ${Xray_URL}Xray-linux-arm32-v6.zip
  88. unzip Xray-linux-arm32-v6.zip
  89. rm -f Xray-linux-arm32-v6.zip
  90. elif [ "${{ matrix.platform }}" == "386" ]; then
  91. wget ${Xray_URL}Xray-linux-32.zip
  92. unzip Xray-linux-32.zip
  93. rm -f Xray-linux-32.zip
  94. elif [ "${{ matrix.platform }}" == "armv5" ]; then
  95. wget ${Xray_URL}Xray-linux-arm32-v5.zip
  96. unzip Xray-linux-arm32-v5.zip
  97. rm -f Xray-linux-arm32-v5.zip
  98. fi
  99. rm -f geoip.dat geosite.dat
  100. wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
  101. wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
  102. wget -O geoip_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
  103. wget -O geosite_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
  104. wget -O geoip_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geoip.dat
  105. wget -O geosite_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geosite.dat
  106. mv xray xray-linux-${{ matrix.platform }}
  107. cd ../..
  108. - name: Package
  109. run: tar -zcvf x-ui-linux-${{ matrix.platform }}.tar.gz x-ui
  110. - name: Upload files to GH release
  111. uses: svenstaro/upload-release-action@v2
  112. with:
  113. repo_token: ${{ secrets.GITHUB_TOKEN }}
  114. tag: ${{ github.ref }}
  115. file: x-ui-linux-${{ matrix.platform }}.tar.gz
  116. asset_name: x-ui-linux-${{ matrix.platform }}.tar.gz
  117. prerelease: true