release.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.20'
  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.1/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.1/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 https://github.com/MasterKia/iran-hosted-domains/releases/latest/download/iran.dat
  55. mv xray xray-linux-${{ matrix.platform }}
  56. cd ../..
  57. - name: Package
  58. run: tar -zcvf x-ui-linux-${{ matrix.platform }}.tar.gz x-ui
  59. - name: Upload
  60. uses: svenstaro/[email protected]
  61. with:
  62. repo_token: ${{ secrets.GITHUB_TOKEN }}
  63. tag: ${{ github.ref }}
  64. file: x-ui-linux-${{ matrix.platform }}.tar.gz
  65. asset_name: x-ui-linux-${{ matrix.platform }}.tar.gz
  66. prerelease: true
  67. overwrite: true