2023-05-29 15:27:12 +03:00
|
|
|
name: Release 3X-ui
|
|
|
|
|
2023-02-09 22:18:06 +03:00
|
|
|
on:
|
2023-04-12 19:19:09 +03:00
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- "*"
|
2023-02-09 22:18:06 +03:00
|
|
|
workflow_dispatch:
|
2023-04-12 19:19:09 +03:00
|
|
|
|
2023-02-09 22:18:06 +03:00
|
|
|
jobs:
|
2023-05-29 15:27:12 +03:00
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-12-19 13:27:04 +03:00
|
|
|
platform: [amd64, arm64, arm]
|
2023-02-09 22:18:06 +03:00
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
2023-05-29 15:27:12 +03:00
|
|
|
- name: Checkout repository
|
2023-10-18 13:01:05 +03:00
|
|
|
uses: actions/checkout@v4.1.1
|
2023-05-29 15:27:12 +03:00
|
|
|
|
|
|
|
- name: Setup Go
|
2023-12-07 13:01:11 +03:00
|
|
|
uses: actions/setup-go@v5.0.0
|
2023-04-12 19:19:09 +03:00
|
|
|
with:
|
2023-08-29 21:44:12 +03:00
|
|
|
go-version: '1.21'
|
2023-05-29 15:27:12 +03:00
|
|
|
|
2023-12-19 13:27:04 +03:00
|
|
|
- name: Install dependencies for arm64 and arm
|
|
|
|
if: matrix.platform == 'arm64' || matrix.platform == 'arm'
|
2023-04-12 19:19:09 +03:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt install gcc-aarch64-linux-gnu
|
2023-12-19 13:27:04 +03:00
|
|
|
if [ "${{ matrix.platform }}" == "arm" ]; then
|
|
|
|
sudo apt install gcc-arm-linux-gnueabihf
|
|
|
|
fi
|
2023-05-29 15:27:12 +03:00
|
|
|
|
|
|
|
- name: Build x-ui
|
|
|
|
run: |
|
|
|
|
export CGO_ENABLED=1
|
|
|
|
export GOOS=linux
|
|
|
|
export GOARCH=${{ matrix.platform }}
|
|
|
|
if [ "${{ matrix.platform }}" == "arm64" ]; then
|
|
|
|
export CC=aarch64-linux-gnu-gcc
|
2023-12-19 13:27:04 +03:00
|
|
|
elif [ "${{ matrix.platform }}" == "arm" ]; then
|
|
|
|
export CC=arm-linux-gnueabihf-gcc
|
2023-05-29 15:27:12 +03:00
|
|
|
fi
|
|
|
|
go build -o xui-release -v main.go
|
|
|
|
|
2023-04-12 19:19:09 +03:00
|
|
|
mkdir x-ui
|
2023-05-29 15:27:12 +03:00
|
|
|
cp xui-release x-ui/
|
|
|
|
cp x-ui.service x-ui/
|
|
|
|
cp x-ui.sh x-ui/
|
|
|
|
mv x-ui/xui-release x-ui/x-ui
|
|
|
|
mkdir x-ui/bin
|
|
|
|
cd x-ui/bin
|
|
|
|
|
|
|
|
# Download dependencies
|
2024-01-10 21:35:19 +03:00
|
|
|
Xray_URL="https://github.com/XTLS/Xray-core/releases/download/v1.8.7/"
|
2023-05-29 15:27:12 +03:00
|
|
|
if [ "${{ matrix.platform }}" == "amd64" ]; then
|
2024-01-10 21:35:19 +03:00
|
|
|
wget ${Xray_URL}Xray-linux-64.zip
|
2023-05-29 15:27:12 +03:00
|
|
|
unzip Xray-linux-64.zip
|
|
|
|
rm -f Xray-linux-64.zip
|
2023-12-19 13:27:04 +03:00
|
|
|
elif [ "${{ matrix.platform }}" == "arm64" ]; then
|
2024-01-10 21:35:19 +03:00
|
|
|
wget ${Xray_URL}Xray-linux-arm64-v8a.zip
|
2023-05-29 15:27:12 +03:00
|
|
|
unzip Xray-linux-arm64-v8a.zip
|
|
|
|
rm -f Xray-linux-arm64-v8a.zip
|
2023-12-19 13:27:04 +03:00
|
|
|
else
|
2024-01-10 21:35:19 +03:00
|
|
|
wget ${Xray_URL}Xray-linux-arm32-v7a.zip
|
2023-12-19 13:27:04 +03:00
|
|
|
unzip Xray-linux-arm32-v7a.zip
|
|
|
|
rm -f Xray-linux-arm32-v7a.zip
|
2023-05-29 15:27:12 +03:00
|
|
|
fi
|
2023-12-19 12:38:37 +03:00
|
|
|
rm -f geoip.dat geosite.dat geoip_IR.dat geosite_IR.dat geoip_VN.dat geosite_VN.dat
|
2023-04-12 19:19:09 +03:00
|
|
|
wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
|
|
|
|
wget https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
|
2023-10-18 12:52:07 +03:00
|
|
|
wget -O geoip_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geoip.dat
|
|
|
|
wget -O geosite_IR.dat https://github.com/chocolate4u/Iran-v2ray-rules/releases/latest/download/geosite.dat
|
2023-12-19 12:38:37 +03:00
|
|
|
wget -O geoip_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geoip.dat
|
|
|
|
wget -O geosite_VN.dat https://github.com/vuong2023/vn-v2ray-rules/releases/latest/download/geosite.dat
|
2023-05-31 23:20:37 +03:00
|
|
|
mv xray xray-linux-${{ matrix.platform }}
|
2023-05-29 15:27:12 +03:00
|
|
|
cd ../..
|
|
|
|
|
|
|
|
- name: Package
|
2023-05-31 23:20:37 +03:00
|
|
|
run: tar -zcvf x-ui-linux-${{ matrix.platform }}.tar.gz x-ui
|
2023-05-29 15:27:12 +03:00
|
|
|
|
|
|
|
- name: Upload
|
2023-07-29 15:31:33 +03:00
|
|
|
uses: svenstaro/upload-release-action@2.7.0
|
2023-04-12 19:19:09 +03:00
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
tag: ${{ github.ref }}
|
2023-05-31 23:20:37 +03:00
|
|
|
file: x-ui-linux-${{ matrix.platform }}.tar.gz
|
|
|
|
asset_name: x-ui-linux-${{ matrix.platform }}.tar.gz
|
2023-04-12 19:19:09 +03:00
|
|
|
prerelease: true
|
|
|
|
overwrite: true
|