Skip to content

Commit 249524e

Browse files
authored
fix: 修复CI中docker镜像构建异常,约束release脚本使用范围 (#74)
1 parent 44afcc1 commit 249524e

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

.github/workflows/CD.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,19 @@ on:
1313
workflow_dispatch:
1414

1515

16-
## vercel 环境变量
16+
# 环境变量
1717
env:
18+
## vercel
1819
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
1920
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
20-
# 阿里云仓库信息
21-
REGISTRY: registry.cn-hangzhou.aliyuncs.com
22-
UserName: mmdapl
2321

2422

2523
jobs:
2624
## 部署到Github-Pages
2725
deploy-github:
2826
name: "部署到Github-Pages"
2927
if: github.repository == '142vip/JavaScriptCollection'
30-
runs-on: macos-latest
28+
runs-on: ubuntu-latest
3129

3230
steps:
3331
- name: Checkout Code
@@ -74,7 +72,7 @@ jobs:
7472
# deploy-vercel:
7573
# name: "部署到Vercel平台"
7674
# needs: install-init
77-
# runs-on: macos-latest
75+
# runs-on: ubuntu-latest
7876
# if: github.repository == '142vip/JavaScriptCollection'
7977
# steps:
8078
# - name: Checkout Code
@@ -102,7 +100,7 @@ jobs:
102100
## 版本发布
103101
release:
104102
name: "创建Github发布"
105-
runs-on: macos-latest
103+
runs-on: ubuntu-latest
106104
## 主库master、next且执行release更新时执行
107105
if: github.repository == '142vip/JavaScriptCollection' && startsWith(github.event.head_commit.message, 'chore(release):')
108106

@@ -156,7 +154,7 @@ jobs:
156154
# Deploy-ESC:
157155
# name: "部署到ESC服务器"
158156
# needs: install-init
159-
# runs-on: macos-latest
157+
# runs-on: ubuntu-latest
160158
# ## 主库master、next且执行release更新时执行
161159
# if: github.repository == '142vip/JavaScriptCollection' && startsWith(github.event.head_commit.message, 'chore(release):')
162160
#

.github/workflows/CI.yaml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ on:
2020
schedule:
2121
- cron: "0 0 1 * *"
2222

23+
# 环境变量
24+
env:
25+
# 阿里云仓库信息
26+
REGISTRY: registry.cn-hangzhou.aliyuncs.com
27+
UserName: 142vip
28+
2329
jobs:
2430
install-init:
2531
name: "流水线初始化"
26-
runs-on: macos-latest
32+
runs-on: ubuntu-latest
2733
if: github.repository == '142vip/JavaScriptCollection'
2834
permissions:
2935
actions: read
@@ -63,8 +69,8 @@ jobs:
6369
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
6470

6571
Base-Build:
66-
name: "基础编译构建"
67-
runs-on: macos-latest
72+
name: "基础编译校验"
73+
runs-on: ubuntu-latest
6874
if: github.repository == '142vip/JavaScriptCollection'
6975
needs:
7076
- install-init
@@ -96,7 +102,8 @@ jobs:
96102
97103
Build-Docker-Image:
98104
name: "构建Docker镜像"
99-
runs-on: macos-latest
105+
## macos不支持docker的使用
106+
runs-on: ubuntu-latest
100107
needs:
101108
- install-init
102109
## 主库master、next且执行release更新时执行
@@ -112,6 +119,9 @@ jobs:
112119
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
113120
fetch-depth: 0
114121

122+
- name: Set up Docker
123+
uses: docker/setup-buildx-action@v3
124+
115125
- name: Login Docker
116126
run: |
117127
docker version

scripts/release

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,15 @@ readonly generateChangeLog='pnpm commit-and-tag-version && git add CHANGELOG.md'
1212
readonly commitInfo='chore(release): publish v%s'
1313

1414

15-
bumpp --preid alpha --execute="$generateChangeLog" --commit "$commitInfo" --all --tag --push
15+
# 获取当前分支名称
16+
current_branch=$(git rev-parse --abbrev-ref HEAD)
17+
18+
# 判断分支名称
19+
if [ "$current_branch" = "next1" ]; then
20+
21+
bumpp --preid alpha --execute="$generateChangeLog" --commit "$commitInfo" --all --tag --push
22+
23+
else
24+
echo "当前分支是:$current_branch ,版本迭代允许在next分之操作,并推送到远程!!!"
25+
fi
26+

0 commit comments

Comments
 (0)