3x-ui/.github/workflows/release.yml

137 lines
5.1 KiB
YAML
Raw Normal View History

2024-01-15 13:14:13 +03:00
name: Release 3X-UI
2023-05-29 15:27:12 +03:00
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:
2024-01-15 13:14:13 +03:00
platform:
- amd64
- arm64
- armv7
- armv6
2024-01-20 12:32:35 +03:00
- 386
- armv5
2024-04-01 12:11:58 +03:00
- s390x
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
2024-02-25 22:01:01 +03:00
uses: actions/checkout@v4
2023-05-29 15:27:12 +03:00
- name: Setup Go
2024-02-25 22:01:01 +03:00
uses: actions/setup-go@v5
2023-04-12 19:19:09 +03:00
with:
2024-02-20 00:44:53 +03:00
go-version: '1.22'
2024-01-15 13:14:13 +03:00
- name: Install dependencies
2023-04-12 19:19:09 +03:00
run: |
sudo apt-get update
2024-01-15 17:51:40 +03:00
if [ "${{ matrix.platform }}" == "arm64" ]; then
2024-01-15 13:14:13 +03:00
sudo apt install gcc-aarch64-linux-gnu
2024-01-20 12:32:35 +03:00
elif [ "${{ matrix.platform }}" == "armv7" ]; then
sudo apt install gcc-arm-linux-gnueabihf
elif [ "${{ matrix.platform }}" == "armv6" ]; then
sudo apt install gcc-arm-linux-gnueabihf
2024-01-20 12:32:35 +03:00
elif [ "${{ matrix.platform }}" == "386" ]; then
sudo apt install gcc-i686-linux-gnu
elif [ "${{ matrix.platform }}" == "armv5" ]; then
sudo apt install gcc-arm-linux-gnueabi
2024-04-01 12:11:58 +03:00
elif [ "${{ matrix.platform }}" == "s390x" ]; then
sudo apt install gcc-s390x-linux-gnu
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
2024-01-15 17:51:40 +03:00
export GOARCH=arm64
2023-05-29 15:27:12 +03:00
export CC=aarch64-linux-gnu-gcc
2024-01-20 12:32:35 +03:00
elif [ "${{ matrix.platform }}" == "armv7" ]; then
2024-01-15 17:51:40 +03:00
export GOARCH=arm
2024-01-15 13:14:13 +03:00
export GOARM=7
export CC=arm-linux-gnueabihf-gcc
2024-01-20 12:32:35 +03:00
elif [ "${{ matrix.platform }}" == "armv6" ]; then
export GOARCH=arm
export GOARM=6
export CC=arm-linux-gnueabihf-gcc
elif [ "${{ matrix.platform }}" == "386" ]; then
export GOARCH=386
export CC=i686-linux-gnu-gcc
elif [ "${{ matrix.platform }}" == "armv5" ]; then
export GOARCH=arm
export GOARM=5
export CC=arm-linux-gnueabi-gcc
2024-04-01 12:11:58 +03:00
elif [ "${{ matrix.platform }}" == "s390x" ]; then
export GOARCH=s390x
export CC=s390x-linux-gnu-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-04-26 11:06:13 +03:00
Xray_URL="https://github.com/XTLS/Xray-core/releases/download/v1.8.11/"
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
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
2024-01-15 13:14:13 +03:00
elif [ "${{ matrix.platform }}" == "armv7" ]; then
2024-01-10 21:35:19 +03:00
wget ${Xray_URL}Xray-linux-arm32-v7a.zip
unzip Xray-linux-arm32-v7a.zip
rm -f Xray-linux-arm32-v7a.zip
2024-01-15 13:14:13 +03:00
elif [ "${{ matrix.platform }}" == "armv6" ]; then
wget ${Xray_URL}Xray-linux-arm32-v6.zip
unzip Xray-linux-arm32-v6.zip
rm -f Xray-linux-arm32-v6.zip
2024-01-20 12:32:35 +03:00
elif [ "${{ matrix.platform }}" == "386" ]; then
wget ${Xray_URL}Xray-linux-32.zip
unzip Xray-linux-32.zip
rm -f Xray-linux-32.zip
elif [ "${{ matrix.platform }}" == "armv5" ]; then
wget ${Xray_URL}Xray-linux-arm32-v5.zip
unzip Xray-linux-arm32-v5.zip
rm -f Xray-linux-arm32-v5.zip
2024-04-01 12:11:58 +03:00
elif [ "${{ matrix.platform }}" == "s390x" ]; then
wget ${Xray_URL}Xray-linux-s390x.zip
unzip Xray-linux-s390x.zip
rm -f Xray-linux-s390x.zip
2023-05-29 15:27:12 +03:00
fi
2024-01-15 13:14:13 +03:00
rm -f geoip.dat geosite.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
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
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
mv xray xray-linux-${{ matrix.platform }}
2023-05-29 15:27:12 +03:00
cd ../..
- name: Package
run: tar -zcvf x-ui-linux-${{ matrix.platform }}.tar.gz x-ui
2023-05-29 15:27:12 +03:00
2024-02-20 04:54:53 +03:00
- name: Upload files to GH release
2024-02-25 22:01:01 +03:00
uses: svenstaro/upload-release-action@v2
2023-04-12 19:19:09 +03:00
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
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