Skip to content

Commit b9b8eed

Browse files
authored
[skip ci]feat(ci): add FRONTEND_REPO variable to workflows and build script (#1006)
1 parent 317d190 commit b9b8eed

File tree

6 files changed

+12
-3
lines changed

6 files changed

+12
-3
lines changed

.github/workflows/beta_release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ jobs:
9393
run: bash build.sh dev web
9494
env:
9595
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96+
FRONTEND_REPO: ${{ vars.FRONTEND_REPO }}
9697

9798
- name: Build
9899
uses: OpenListTeam/[email protected]

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
run: bash build.sh dev web
4040
env:
4141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
FRONTEND_REPO: ${{ vars.FRONTEND_REPO }}
4243

4344
- name: Build
4445
uses: OpenListTeam/[email protected]

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
bash build.sh release ${{ matrix.build-type == 'lite' && 'lite' || '' }} ${{ matrix.target-platform }}
6767
env:
6868
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
FRONTEND_REPO: ${{ vars.FRONTEND_REPO }}
6970

7071
- name: Upload assets
7172
uses: softprops/action-gh-release@v2

.github/workflows/release_docker.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ jobs:
6666
run: bash build.sh release docker-multiplatform
6767
env:
6868
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
FRONTEND_REPO: ${{ vars.FRONTEND_REPO }}
6970

7071
- name: Upload artifacts
7172
uses: actions/upload-artifact@v4
@@ -105,6 +106,7 @@ jobs:
105106
run: bash build.sh release lite docker-multiplatform
106107
env:
107108
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109+
FRONTEND_REPO: ${{ vars.FRONTEND_REPO }}
108110

109111
- name: Upload artifacts
110112
uses: actions/upload-artifact@v4

.github/workflows/test_docker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
run: bash build.sh beta docker-multiplatform
5656
env:
5757
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
FRONTEND_REPO: ${{ vars.FRONTEND_REPO }}
5859

5960
- name: Upload artifacts
6061
uses: actions/upload-artifact@v4

build.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ builtAt="$(date +'%F %T %z')"
44
gitAuthor="The OpenList Projects Contributors <[email protected]>"
55
gitCommit=$(git log --pretty=format:"%h" -1)
66

7+
# Set frontend repository, default to OpenListTeam/OpenList-Frontend
8+
frontendRepo="${FRONTEND_REPO:-OpenListTeam/OpenList-Frontend}"
9+
710
githubAuthArgs=""
811
if [ -n "$GITHUB_TOKEN" ]; then
912
githubAuthArgs="--header \"Authorization: Bearer $GITHUB_TOKEN\""
@@ -25,7 +28,7 @@ else
2528
git tag -d beta || true
2629
# Always true if there's no tag
2730
version=$(git describe --abbrev=0 --tags 2>/dev/null || echo "v0.0.0")
28-
webVersion=$(eval "curl -fsSL --max-time 2 $githubAuthArgs \"https://api.github.com/repos/OpenListTeam/OpenList-Frontend/releases/latest\"" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
31+
webVersion=$(eval "curl -fsSL --max-time 2 $githubAuthArgs \"https://api.github.com/repos/$frontendRepo/releases/latest\"" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
2932
fi
3033

3134
echo "backend version: $version"
@@ -46,7 +49,7 @@ ldflags="\
4649
"
4750

4851
FetchWebRolling() {
49-
pre_release_json=$(eval "curl -fsSL --max-time 2 $githubAuthArgs -H \"Accept: application/vnd.github.v3+json\" \"https://api.github.com/repos/OpenListTeam/OpenList-Frontend/releases/tags/rolling\"")
52+
pre_release_json=$(eval "curl -fsSL --max-time 2 $githubAuthArgs -H \"Accept: application/vnd.github.v3+json\" \"https://api.github.com/repos/$frontendRepo/releases/tags/rolling\"")
5053
pre_release_assets=$(echo "$pre_release_json" | jq -r '.assets[].browser_download_url')
5154

5255
# There is no lite for rolling
@@ -59,7 +62,7 @@ FetchWebRolling() {
5962
}
6063

6164
FetchWebRelease() {
62-
release_json=$(eval "curl -fsSL --max-time 2 $githubAuthArgs -H \"Accept: application/vnd.github.v3+json\" \"https://api.github.com/repos/OpenListTeam/OpenList-Frontend/releases/latest\"")
65+
release_json=$(eval "curl -fsSL --max-time 2 $githubAuthArgs -H \"Accept: application/vnd.github.v3+json\" \"https://api.github.com/repos/$frontendRepo/releases/latest\"")
6366
release_assets=$(echo "$release_json" | jq -r '.assets[].browser_download_url')
6467

6568
if [ "$useLite" = true ]; then

0 commit comments

Comments
 (0)