release.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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]
  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
  21. if: matrix.platform == 'arm64'
  22. run: |
  23. sudo apt-get update
  24. sudo apt install gcc-aarch64-linux-gnu
  25. - name: Build x-ui
  26. run: |
  27. export CGO_ENABLED=1
  28. export GOOS=linux
  29. export GOARCH=${{ matrix.platform }}
  30. if [ "${{ matrix.platform }}" == "arm64" ]; then
  31. export CC=aarch64-linux-gnu-gcc
  32. fi
  33. go build -o xui-release -v main.go
  34. mkdir x-ui
  35. cp xui-release x-ui/
  36. cp x-ui.service x-ui/
  37. cp x-ui.sh x-ui/
  38. mv x-ui/xui-release x-ui/x-ui
  39. mkdir x-ui/bin
  40. cd x-ui/bin
  41. # Download dependencies
  42. if [ "${{ matrix.platform }}" == "amd64" ]; then
  43. wget https://github.com/XTLS/Xray-core/releases/download/v1.8.4/Xray-linux-64.zip
  44. unzip Xray-linux-64.zip
  45. rm -f Xray-linux-64.zip
  46. else
  47. wget https://github.com/XTLS/Xray-core/releases/download/v1.8.4/Xray-linux-arm64-v8a.zip
  48. unzip Xray-linux-arm64-v8a.zip
  49. rm -f Xray-linux-arm64-v8a.zip
  50. fi
  51. rm -f geoip.dat geosite.dat iran.dat
  52. wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
  53. wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
  54. wget -O geoip_ch.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
  55. wget -O geosite_ch.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
  56. wget https://github.com/MasterKia/iran-hosted-domains/releases/latest/download/iran.dat
  57. mv xray xray-linux-${{ matrix.platform }}
  58. cd ../..
  59. - name: Package
  60. run: tar -zcvf x-ui-linux-${{ matrix.platform }}.tar.gz x-ui
  61. - name: Upload
  62. uses: svenstaro/[email protected]
  63. with:
  64. repo_token: ${{ secrets.GITHUB_TOKEN }}
  65. tag: ${{ github.ref }}
  66. file: x-ui-linux-${{ matrix.platform }}.tar.gz
  67. asset_name: x-ui-linux-${{ matrix.platform }}.tar.gz
  68. prerelease: true
  69. overwrite: true