From 2ca3a17cadee5465cc199996b99975e14519c761 Mon Sep 17 00:00:00 2001 From: admin8800 Date: Sun, 10 May 2026 16:29:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E5=8C=96=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker.yml | 11 ++++++++++- .github/workflows/release.yml | 13 +++++++++++-- .github/workflows/windows.yml | 13 +++++++++++-- README.md | 4 ++-- install.sh | 7 ++++--- s-ui.sh | 4 +++- 6 files changed, 41 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index cc1812c..a49eb4b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -38,6 +38,15 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: 规范化发布标签 + id: vars + run: | + TAG="${{ inputs.tag }}" + case "$TAG" in + v*) echo "tag=$TAG" >> "$GITHUB_OUTPUT" ;; + *) echo "tag=v$TAG" >> "$GITHUB_OUTPUT" ;; + esac + - name: 构建并推送 Docker 镜像 uses: docker/build-push-action@v7 with: @@ -46,5 +55,5 @@ jobs: platforms: linux/amd64,linux/386,linux/arm64/v8,linux/arm/v7,linux/arm/v6 push: true tags: | - ${{ env.IMAGE_NAME }}:${{ inputs.tag }} + ${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.tag }} ${{ env.IMAGE_NAME }}:latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0c73760..558f2f0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -173,6 +173,15 @@ jobs: needs: build-linux runs-on: ubuntu-latest steps: + - name: 规范化发布标签 + id: vars + run: | + TAG="${{ inputs.tag }}" + case "$TAG" in + v*) echo "tag=$TAG" >> "$GITHUB_OUTPUT" ;; + *) echo "tag=v$TAG" >> "$GITHUB_OUTPUT" ;; + esac + - name: 下载 Linux 构建产物 uses: actions/download-artifact@v8 with: @@ -183,8 +192,8 @@ jobs: - name: 发布到当前仓库 Release uses: softprops/action-gh-release@v3 with: - tag_name: ${{ inputs.tag }} - name: S-UI ${{ inputs.tag }} + tag_name: ${{ steps.vars.outputs.tag }} + name: S-UI ${{ steps.vars.outputs.tag }} target_commitish: ${{ github.sha }} prerelease: true fail_on_unmatched_files: true diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 6b18c22..b9a3727 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -125,6 +125,15 @@ jobs: needs: build-windows runs-on: ubuntu-latest steps: + - name: 规范化发布标签 + id: vars + run: | + TAG="${{ inputs.tag }}" + case "$TAG" in + v*) echo "tag=$TAG" >> "$GITHUB_OUTPUT" ;; + *) echo "tag=v$TAG" >> "$GITHUB_OUTPUT" ;; + esac + - name: 下载 Windows 构建产物 uses: actions/download-artifact@v8 with: @@ -135,8 +144,8 @@ jobs: - name: 发布到当前仓库 Release uses: softprops/action-gh-release@v3 with: - tag_name: ${{ inputs.tag }} - name: S-UI ${{ inputs.tag }} + tag_name: ${{ steps.vars.outputs.tag }} + name: S-UI ${{ steps.vars.outputs.tag }} target_commitish: ${{ github.sha }} prerelease: true fail_on_unmatched_files: true diff --git a/README.md b/README.md index 691edb7..bd421df 100644 --- a/README.md +++ b/README.md @@ -50,10 +50,10 @@ bash <(curl -Ls https://raw.githubusercontent.com/admin8800/s-ui/main/install.sh ## 安装旧版本 -**步骤 1:** 如果要安装指定旧版本,请在安装命令末尾追加版本号。例如版本 `1.0.0`: +**步骤 1:** 如果要安装指定旧版本,请在安装命令末尾追加带 `v` 的版本标签。例如版本 `v1.0.0`: ```sh -VERSION=1.0.0 && bash <(curl -Ls https://raw.githubusercontent.com/admin8800/s-ui/$VERSION/install.sh) $VERSION +VERSION=v1.0.0 && bash <(curl -Ls https://raw.githubusercontent.com/admin8800/s-ui/$VERSION/install.sh) $VERSION ``` ## 手动安装 diff --git a/install.sh b/install.sh index efc1d8f..fa549a9 100644 --- a/install.sh +++ b/install.sh @@ -148,11 +148,12 @@ install_s-ui() { fi else last_version=$1 + [[ "${last_version}" != v* ]] && last_version="v${last_version}" url="https://github.com/admin8800/s-ui/releases/download/${last_version}/s-ui-linux-$(arch).tar.gz" - echo -e "开始安装 s-ui v$1" + echo -e "开始安装 s-ui ${last_version}" wget -N --no-check-certificate -O /tmp/s-ui-linux-$(arch).tar.gz ${url} if [[ $? -ne 0 ]]; then - echo -e "${red}下载 s-ui v$1 失败,请检查该版本是否存在${plain}" + echo -e "${red}下载 s-ui ${last_version} 失败,请检查该版本是否存在${plain}" exit 1 fi fi @@ -175,7 +176,7 @@ install_s-ui() { systemctl enable s-ui --now - echo -e "${green}s-ui v${last_version}${plain} 安装完成,现已启动并运行..." + echo -e "${green}s-ui ${last_version}${plain} 安装完成,现已启动并运行..." echo -e "你可以通过以下 URL 访问面板:${green}" /usr/local/s-ui/sui uri echo -e "${plain}" diff --git a/s-ui.sh b/s-ui.sh index d6dade6..0ff5b2f 100644 --- a/s-ui.sh +++ b/s-ui.sh @@ -90,7 +90,7 @@ update() { } custom_version() { - echo "请输入面板版本(例如 0.0.1):" + echo "请输入面板版本(例如 v1.4.1):" read panel_version if [ -z "$panel_version" ]; then @@ -98,6 +98,8 @@ custom_version() { exit 1 fi + [[ "${panel_version}" != v* ]] && panel_version="v${panel_version}" + download_link="https://raw.githubusercontent.com/admin8800/s-ui/main/install.sh" install_command="bash <(curl -Ls $download_link) $panel_version"