From c2633dd4436a2337246979a9d866f7e408e6c2ea Mon Sep 17 00:00:00 2001 From: Jealous Date: Thu, 23 Jan 2025 22:49:35 +0800 Subject: [PATCH] fix(workflow): use the dev version of the web for beta releases (#7862) * fix(workflow): use dev version of the web for beta releases * chore(config): check version string by prefix --- .github/workflows/release_docker.yml | 7 ++++++- build.sh | 11 +++++++++-- internal/bootstrap/config.go | 2 +- internal/bootstrap/patch.go | 3 ++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release_docker.yml b/.github/workflows/release_docker.yml index f4c79baf..7cd05549 100644 --- a/.github/workflows/release_docker.yml +++ b/.github/workflows/release_docker.yml @@ -52,7 +52,12 @@ jobs: if: steps.cache-musl.outputs.cache-hit != 'true' run: bash build.sh prepare docker-multiplatform - - name: Build go binary + - name: Build go binary (beta) + if: env.IMAGE_IS_PROD != 'true' + run: bash build.sh beta docker-multiplatform + + - name: Build go binary (release) + if: env.IMAGE_IS_PROD == 'true' run: bash build.sh release docker-multiplatform - name: Upload artifacts diff --git a/build.sh b/build.sh index a87eabf4..d6e001c2 100644 --- a/build.sh +++ b/build.sh @@ -7,6 +7,9 @@ gitCommit=$(git log --pretty=format:"%h" -1) if [ "$1" = "dev" ]; then version="dev" webVersion="dev" +elif [ "$1" = "beta" ]; then + version="beta" + webVersion="dev" else git tag -d beta version=$(git describe --abbrev=0 --tags) @@ -301,8 +304,12 @@ if [ "$1" = "dev" ]; then else BuildDev fi -elif [ "$1" = "release" ]; then - FetchWebRelease +elif [ "$1" = "release" -o "$1" = "beta" ]; then + if [ "$1" = "beta" ]; then + FetchWebDev + else + FetchWebRelease + fi if [ "$2" = "docker" ]; then BuildDocker elif [ "$2" = "docker-multiplatform" ]; then diff --git a/internal/bootstrap/config.go b/internal/bootstrap/config.go index a44c7350..38b1aa9e 100644 --- a/internal/bootstrap/config.go +++ b/internal/bootstrap/config.go @@ -50,7 +50,7 @@ func InitConfig() { log.Fatalf("load config error: %+v", err) } LastLaunchedVersion = conf.Conf.LastLaunchedVersion - if conf.Version != "dev" || LastLaunchedVersion == "" { + if strings.HasPrefix(conf.Version, "v") || LastLaunchedVersion == "" { conf.Conf.LastLaunchedVersion = conf.Version } // update config.json struct diff --git a/internal/bootstrap/patch.go b/internal/bootstrap/patch.go index 8dc3ed02..2d22d1b6 100644 --- a/internal/bootstrap/patch.go +++ b/internal/bootstrap/patch.go @@ -5,6 +5,7 @@ import ( "github.com/alist-org/alist/v3/internal/bootstrap/patch" "github.com/alist-org/alist/v3/internal/conf" "github.com/alist-org/alist/v3/pkg/utils" + "strings" ) var LastLaunchedVersion = "" @@ -38,7 +39,7 @@ func compareVersion(majorA, minorA, patchNumA, majorB, minorB, patchNumB int) bo } func InitUpgradePatch() { - if conf.Version == "dev" { + if !strings.HasPrefix(conf.Version, "v") { return } if LastLaunchedVersion == conf.Version {