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

78 lines
2.5 KiB
YAML
Raw Normal View History

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:
platform: [amd64, arm64]
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
uses: actions/checkout@v4.1.1
2023-05-29 15:27:12 +03:00
- name: Setup Go
uses: actions/setup-go@v4.1.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
- name: Install dependencies for arm64
if: matrix.platform == 'arm64'
2023-04-12 19:19:09 +03:00
run: |
sudo apt-get update
sudo apt install gcc-aarch64-linux-gnu
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
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
if [ "${{ matrix.platform }}" == "amd64" ]; then
2023-11-20 02:11:05 +03:00
wget https://github.com/XTLS/Xray-core/releases/download/v1.8.6/Xray-linux-64.zip
2023-05-29 15:27:12 +03:00
unzip Xray-linux-64.zip
rm -f Xray-linux-64.zip
else
2023-11-20 02:11:05 +03:00
wget https://github.com/XTLS/Xray-core/releases/download/v1.8.6/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
fi
rm -f geoip.dat geosite.dat geoip_IR.dat geosite_IR.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
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
- name: Upload
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 }}
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