add/fix releases

This commit is contained in:
Alireza Ahmadi
2024-03-01 11:11:38 +01:00
parent c687a42d7e
commit edc1038623
3 changed files with 71 additions and 54 deletions
+22 -12
View File
@@ -10,14 +10,18 @@ jobs:
build: build:
strategy: strategy:
matrix: matrix:
platform: [amd64, arm64, arm] platform:
- amd64
- arm64
- armv7
- 386
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.1
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v5.0.0 uses: actions/setup-go@v5
with: with:
cache: false cache: false
go-version: '1.22' go-version: '1.22'
@@ -28,13 +32,15 @@ jobs:
node-version: '20' node-version: '20'
registry-url: 'https://registry.npmjs.org' registry-url: 'https://registry.npmjs.org'
- name: Install dependencies for arm64 and arm - name: Install dependencies
if: matrix.platform == 'arm64' || matrix.platform == 'arm'
run: | run: |
sudo apt-get update sudo apt-get update
if [ "${{ matrix.platform }}" == "arm64" ]; then
sudo apt install gcc-aarch64-linux-gnu sudo apt install gcc-aarch64-linux-gnu
if [ "${{ matrix.platform }}" == "arm" ]; then elif [ "${{ matrix.platform }}" == "armv7" ]; then
sudo apt install gcc-arm-linux-gnueabihf sudo apt install gcc-arm-linux-gnueabihf
elif [ "${{ matrix.platform }}" == "386" ]; then
sudo apt install gcc-i686-linux-gnu
fi fi
- name: Build frontend - name: Build frontend
@@ -45,26 +51,30 @@ jobs:
cd .. cd ..
mv frontend/dist backend/web/html mv frontend/dist backend/web/html
- name: Set evironments - name: Build s-ui & singbox
run: | run: |
export CGO_ENABLED=1 export CGO_ENABLED=1
export GOOS=linux export GOOS=linux
export GOARCH=${{ matrix.platform }} export GOARCH=${{ matrix.platform }}
if [ "${{ matrix.platform }}" == "arm64" ]; then if [ "${{ matrix.platform }}" == "arm64" ]; then
export GOARCH=arm64
export CC=aarch64-linux-gnu-gcc export CC=aarch64-linux-gnu-gcc
elif [ "${{ matrix.platform }}" == "arm" ]; then elif [ "${{ matrix.platform }}" == "armv7" ]; then
export GOARCH=arm
export GOARM=7
export CC=arm-linux-gnueabihf-gcc export CC=arm-linux-gnueabihf-gcc
elif [ "${{ matrix.platform }}" == "386" ]; then
export GOARCH=386
export CC=i686-linux-gnu-gcc
fi fi
- name: Build sing-box #### Build Sing-Box
run: |
git clone -b v1.8.5 https://github.com/SagerNet/sing-box git clone -b v1.8.5 https://github.com/SagerNet/sing-box
cd sing-box cd sing-box
go build -tags with_v2ray_api,with_clash_api,with_grpc,with_quic,with_ech -o sing-box ./cmd/sing-box go build -tags with_v2ray_api,with_clash_api,with_grpc,with_quic,with_ech -o sing-box ./cmd/sing-box
cd .. cd ..
- name: Build s-ui ### Build s-ui
run: |
cd backend cd backend
go build -o ../sui main.go go build -o ../sui main.go
cd .. cd ..
@@ -81,7 +91,7 @@ jobs:
run: tar -zcvf s-ui-linux-${{ matrix.platform }}.tar.gz s-ui run: tar -zcvf s-ui-linux-${{ matrix.platform }}.tar.gz s-ui
- name: Upload - name: Upload
uses: svenstaro/upload-release-action@2.9.0 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }} tag: ${{ github.ref }}
+36 -33
View File
@@ -23,25 +23,17 @@ else
fi fi
echo "The OS release is: $release" echo "The OS release is: $release"
arch=$(arch) arch() {
case "$(uname -m)" in
x86_64 | x64 | amd64) echo 'amd64' ;;
i*86 | x86) echo '386' ;;
armv8* | armv8 | arm64 | aarch64) echo 'arm64' ;;
armv7* | armv7 | arm) echo 'armv7' ;;
*) echo -e "${green}Unsupported CPU architecture! ${plain}" && rm -f install.sh && exit 1 ;;
esac
}
if [[ $arch == "x86_64" || $arch == "x64" || $arch == "amd64" ]]; then echo "arch: $(arch)"
arch="amd64"
elif [[ $arch == "aarch64" || $arch == "arm64" ]]; then
arch="arm64"
elif [[ $arch == "s390x" ]]; then
arch="s390x"
else
arch="amd64"
echo -e "${red} Failed to check system arch, will use default arch: ${arch}${plain}"
fi
echo "arch: ${arch}"
if [ $(getconf WORD_BIT) != '32' ] && [ $(getconf LONG_BIT) != '64' ]; then
echo "s-ui dosen't support 32-bit(x86) system, please use 64 bit operating system(x86_64) instead, if there is something wrong, please get in touch with me!"
exit -1
fi
os_version="" os_version=""
os_version=$(grep -i version_id /etc/os-release | cut -d \" -f2 | cut -d . -f1) os_version=$(grep -i version_id /etc/os-release | cut -d \" -f2 | cut -d . -f1)
@@ -70,27 +62,38 @@ fi
install_base() { install_base() {
if [[ "${release}" == "centos" ]] || [[ "${release}" == "fedora" ]] ; then case "${release}" in
yum install wget curl tar unzip jq -y centos)
else yum -y update && yum install -y -q wget curl tar tzdata
apt install wget curl tar unzip jq -y ;;
fi fedora)
dnf -y update && dnf install -y -q wget curl tar tzdata
;;
*)
apt-get update && apt install -y -q wget curl tar tzdata
;;
esac
} }
config_after_install() { config_after_install() {
echo -e "${yellow}Install/update finished! For security it's recommended to modify panel settings ${plain}" echo -e "${yellow}Install/update finished! For security it's recommended to modify panel settings ${plain}"
read -p "Do you want to continue with the modification [y/n]? ": config_confirm read -p "Do you want to continue with the modification [y/n]? ": config_confirm
if [[ "${config_confirm}" == "y" || "${config_confirm}" == "Y" ]]; then if [[ "${config_confirm}" == "y" || "${config_confirm}" == "Y" ]]; then
read -p "Please set up the panel port (leave blank for existing/default value):" config_port read -p "Enter the ${yellow}panel port${plain} (leave blank for existing/default value):" config_port
read -p "Please set up the panel path (leave blank for existing/default value):" config_path read -p "Enter the ${yellow}panel path${plain} (leave blank for existing/default value):" config_path
# Sub configuration # Sub configuration
read -p "Please set up the subscription port (leave blank for existing/default value):" config_port read -p "Enter the ${yellow}subscription port${plain} (leave blank for existing/default value):" config_subPort
read -p "Please set up the subscription path (leave blank for existing/default value):" config_path read -p "Enter the ${yellow}subscription path${plain} (leave blank for existing/default value):" config_subPath
# Set configs # Set configs
echo -e "${yellow}Initializing, please wait...${plain}" echo -e "${yellow}Initializing, please wait...${plain}"
/usr/local/s-ui/sui setting -port ${config_port} -path ${config_path} -subPort ${config_subPort} -subPath ${config_subPath} params=""
[ -z "$config_port" ] || params="$params -port $config_port"
[ -z "$config_path" ] || params="$params -path $config_path"
[ -z "$config_subPort" ] || params="$params -subPort $config_subPort"
[ -z "$config_subPath" ] || params="$params -subPath $config_subPath"
/usr/local/s-ui/sui setting ${params}
read -p "Do you want to change admin credentials [y/n]? ": admin_confirm read -p "Do you want to change admin credentials [y/n]? ": admin_confirm
if [[ "${admin_confirm}" == "y" || "${admin_confirm}" == "Y" ]]; then if [[ "${admin_confirm}" == "y" || "${admin_confirm}" == "Y" ]]; then
@@ -133,16 +136,16 @@ install_s-ui() {
exit 1 exit 1
fi fi
echo -e "Got s-ui latest version: ${last_version}, beginning the installation..." echo -e "Got s-ui latest version: ${last_version}, beginning the installation..."
wget -N --no-check-certificate -O /tmp/s-ui-linux-${arch}.tar.gz https://github.com/alireza0/s-ui/releases/download/${last_version}/s-ui-linux-${arch}.tar.gz wget -N --no-check-certificate -O /tmp/s-ui-linux-$(arch).tar.gz https://github.com/alireza0/s-ui/releases/download/${last_version}/s-ui-linux-$(arch).tar.gz
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo -e "${red}Dowanloading s-ui failed, please be sure that your server can access Github ${plain}" echo -e "${red}Dowanloading s-ui failed, please be sure that your server can access Github ${plain}"
exit 1 exit 1
fi fi
else else
last_version=$1 last_version=$1
url="https://github.com/alireza0/s-ui/releases/download/${last_version}/s-ui-linux-${arch}.tar.gz" url="https://github.com/alireza0/s-ui/releases/download/${last_version}/s-ui-linux-$(arch).tar.gz"
echo -e "Begining to install s-ui v$1" echo -e "Begining to install s-ui v$1"
wget -N --no-check-certificate -O /tmp/s-ui-linux-${arch}.tar.gz ${url} wget -N --no-check-certificate -O /tmp/s-ui-linux-$(arch).tar.gz ${url}
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
echo -e "${red}dowanload s-ui v$1 failed,please check the verison exists${plain}" echo -e "${red}dowanload s-ui v$1 failed,please check the verison exists${plain}"
exit 1 exit 1
@@ -154,8 +157,8 @@ install_s-ui() {
systemctl stop sing-box systemctl stop sing-box
fi fi
tar zxvf s-ui-linux-${arch}.tar.gz tar zxvf s-ui-linux-$(arch).tar.gz
rm s-ui-linux-${arch}.tar.gz -f rm s-ui-linux-$(arch).tar.gz -f
wget --no-check-certificate -O /usr/bin/s-ui https://raw.githubusercontent.com/alireza0/s-ui/main/s-ui.sh wget --no-check-certificate -O /usr/bin/s-ui https://raw.githubusercontent.com/alireza0/s-ui/main/s-ui.sh
+11 -7
View File
@@ -164,7 +164,7 @@ uninstall() {
reset_admin() { reset_admin() {
echo "It is not recommended to set admin's credentials to default!" echo "It is not recommended to set admin's credentials to default!"
confirm "Are you sure you want to reset admin's credentials to default ?" "n" confirm "Are you sure you want to reset admin's credentials to default ?" "n"
if [[ $? != 0 ]]; then if [[ $? == 0 ]]; then
/usr/local/s-ui/sui admin -reset /usr/local/s-ui/sui admin -reset
fi fi
before_show_menu before_show_menu
@@ -192,17 +192,21 @@ reset_setting() {
} }
set_setting() { set_setting() {
echo "It is not recommended to set admin's credentials to a complex text." read -p "Enter the ${yellow}panel port${plain} (leave blank for existing/default value):" config_port
read -p "Please set up the panel port (leave blank for existing/default value):" config_port read -p "Enter the ${yellow}panel path${plain} (leave blank for existing/default value):" config_path
read -p "Please set up the panel path (leave blank for existing/default value):" config_path
# Sub configuration # Sub configuration
read -p "Please set up the subscription port (leave blank for existing/default value):" config_port read -p "Enter the ${yellow}subscription port${plain} (leave blank for existing/default value):" config_subPort
read -p "Please set up the subscription path (leave blank for existing/default value):" config_path read -p "Enter the ${yellow}subscription path${plain} (leave blank for existing/default value):" config_subPath
# Set configs # Set configs
echo -e "${yellow}Initializing, please wait...${plain}" echo -e "${yellow}Initializing, please wait...${plain}"
/usr/local/s-ui/sui setting -port ${config_port} -path ${config_path} -subPort ${config_subPort} -subPath ${config_subPath} params=""
[ -z "$config_port" ] || params="$params -port $config_port"
[ -z "$config_path" ] || params="$params -path $config_path"
[ -z "$config_subPort" ] || params="$params -subPort $config_subPort"
[ -z "$config_subPath" ] || params="$params -subPath $config_subPath"
/usr/local/s-ui/sui setting ${params}
before_show_menu before_show_menu
} }