release.yml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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.6/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.6/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 geoip_IR.dat geosite_IR.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_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
  55. wget -O geosite_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
  56. mv xray xray-linux-${{ matrix.platform }}
  57. cd ../..
  58. - name: Package
  59. run: tar -zcvf x-ui-linux-${{ matrix.platform }}.tar.gz x-ui
  60. - name: Upload
  61. uses: svenstaro/[email protected]
  62. with:
  63. repo_token: ${{ secrets.GITHUB_TOKEN }}
  64. tag: ${{ github.ref }}
  65. file: x-ui-linux-${{ matrix.platform }}.tar.gz
  66. asset_name: x-ui-linux-${{ matrix.platform }}.tar.gz
  67. prerelease: true
  68. overwrite: true