release.yml 5.3 KB

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