release.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. runs-on: ubuntu-20.04
  17. steps:
  18. - name: Checkout repository
  19. uses: actions/[email protected]
  20. - name: Setup Go
  21. uses: actions/[email protected]
  22. with:
  23. go-version: '1.21'
  24. - name: Install dependencies
  25. run: |
  26. sudo apt-get update
  27. if [ "${{ matrix.platform }}" == "amd64" ]; then
  28. # Add any amd64 specific dependencies here
  29. elif [ "${{ matrix.platform }}" == "arm64" ]; then
  30. sudo apt install gcc-aarch64-linux-gnu
  31. elif [ "${{ matrix.platform }}" == "armv7" ] || [ "${{ matrix.platform }}" == "armv6" ]; then
  32. sudo apt install gcc-arm-linux-gnueabihf
  33. fi
  34. - name: Build x-ui
  35. run: |
  36. export CGO_ENABLED=1
  37. export GOOS=linux
  38. export GOARCH=${{ matrix.platform }}
  39. if [ "${{ matrix.platform }}" == "arm64" ]; then
  40. export CC=aarch64-linux-gnu-gcc
  41. elif [ "${{ matrix.platform }}" == "armv7" ] || [ "${{ matrix.platform }}" == "armv6" ]; then
  42. export GOARM=7
  43. export CC=arm-linux-gnueabihf-gcc
  44. fi
  45. go build -o xui-release -v main.go
  46. mkdir x-ui
  47. cp xui-release x-ui/
  48. cp x-ui.service x-ui/
  49. cp x-ui.sh x-ui/
  50. mv x-ui/xui-release x-ui/x-ui
  51. mkdir x-ui/bin
  52. cd x-ui/bin
  53. # Download dependencies
  54. Xray_URL="https://github.com/XTLS/Xray-core/releases/download/v1.8.7/"
  55. if [ "${{ matrix.platform }}" == "amd64" ]; then
  56. wget ${Xray_URL}Xray-linux-64.zip
  57. unzip Xray-linux-64.zip
  58. rm -f Xray-linux-64.zip
  59. elif [ "${{ matrix.platform }}" == "arm64" ]; then
  60. wget ${Xray_URL}Xray-linux-arm64-v8a.zip
  61. unzip Xray-linux-arm64-v8a.zip
  62. rm -f Xray-linux-arm64-v8a.zip
  63. elif [ "${{ matrix.platform }}" == "armv7" ]; then
  64. wget ${Xray_URL}Xray-linux-arm32-v7a.zip
  65. unzip Xray-linux-arm32-v7a.zip
  66. rm -f Xray-linux-arm32-v7a.zip
  67. elif [ "${{ matrix.platform }}" == "armv6" ]; then
  68. wget ${Xray_URL}Xray-linux-arm32-v6.zip
  69. unzip Xray-linux-arm32-v6.zip
  70. rm -f Xray-linux-arm32-v6.zip
  71. fi
  72. rm -f geoip.dat geosite.dat
  73. wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
  74. wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
  75. wget -O geoip_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
  76. wget -O geosite_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
  77. wget -O geoip_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geoip.dat
  78. wget -O geosite_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geosite.dat
  79. mv xray xray-linux-${{ matrix.platform }}
  80. cd ../..
  81. - name: Package
  82. run: tar -zcvf x-ui-linux-${{ matrix.platform }}.tar.gz x-ui
  83. - name: Upload
  84. uses: svenstaro/[email protected]
  85. with:
  86. repo_token: ${{ secrets.GITHUB_TOKEN }}
  87. tag: ${{ github.ref }}
  88. file: x-ui-linux-${{ matrix.platform }}.tar.gz
  89. asset_name: x-ui-linux-${{ matrix.platform }}.tar.gz
  90. prerelease: true
  91. overwrite: true