Skip to content

Commit

Permalink
fix: 修复CI中docker镜像构建异常,约束release脚本使用范围 (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmdapl committed Oct 23, 2023
1 parent 44afcc1 commit 249524e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/CD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,19 @@ on:
workflow_dispatch:


## vercel 环境变量
# 环境变量
env:
## vercel
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
# 阿里云仓库信息
REGISTRY: registry.cn-hangzhou.aliyuncs.com
UserName: mmdapl


jobs:
## 部署到Github-Pages
deploy-github:
name: "部署到Github-Pages"
if: github.repository == '142vip/JavaScriptCollection'
runs-on: macos-latest
runs-on: ubuntu-latest

steps:
- name: Checkout Code
Expand Down Expand Up @@ -74,7 +72,7 @@ jobs:
# deploy-vercel:
# name: "部署到Vercel平台"
# needs: install-init
# runs-on: macos-latest
# runs-on: ubuntu-latest
# if: github.repository == '142vip/JavaScriptCollection'
# steps:
# - name: Checkout Code
Expand Down Expand Up @@ -102,7 +100,7 @@ jobs:
## 版本发布
release:
name: "创建Github发布"
runs-on: macos-latest
runs-on: ubuntu-latest
## 主库master、next且执行release更新时执行
if: github.repository == '142vip/JavaScriptCollection' && startsWith(github.event.head_commit.message, 'chore(release):')

Expand Down Expand Up @@ -156,7 +154,7 @@ jobs:
# Deploy-ESC:
# name: "部署到ESC服务器"
# needs: install-init
# runs-on: macos-latest
# runs-on: ubuntu-latest
# ## 主库master、next且执行release更新时执行
# if: github.repository == '142vip/JavaScriptCollection' && startsWith(github.event.head_commit.message, 'chore(release):')
#
Expand Down
18 changes: 14 additions & 4 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ on:
schedule:
- cron: "0 0 1 * *"

# 环境变量
env:
# 阿里云仓库信息
REGISTRY: registry.cn-hangzhou.aliyuncs.com
UserName: 142vip

jobs:
install-init:
name: "流水线初始化"
runs-on: macos-latest
runs-on: ubuntu-latest
if: github.repository == '142vip/JavaScriptCollection'
permissions:
actions: read
Expand Down Expand Up @@ -63,8 +69,8 @@ jobs:
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}

Base-Build:
name: "基础编译构建"
runs-on: macos-latest
name: "基础编译校验"
runs-on: ubuntu-latest
if: github.repository == '142vip/JavaScriptCollection'
needs:
- install-init
Expand Down Expand Up @@ -96,7 +102,8 @@ jobs:
Build-Docker-Image:
name: "构建Docker镜像"
runs-on: macos-latest
## macos不支持docker的使用
runs-on: ubuntu-latest
needs:
- install-init
## 主库master、next且执行release更新时执行
Expand All @@ -112,6 +119,9 @@ jobs:
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0

- name: Set up Docker
uses: docker/setup-buildx-action@v3

- name: Login Docker
run: |
docker version
Expand Down
13 changes: 12 additions & 1 deletion scripts/release
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,15 @@ readonly generateChangeLog='pnpm commit-and-tag-version && git add CHANGELOG.md'
readonly commitInfo='chore(release): publish v%s'


bumpp --preid alpha --execute="$generateChangeLog" --commit "$commitInfo" --all --tag --push
# 获取当前分支名称
current_branch=$(git rev-parse --abbrev-ref HEAD)

# 判断分支名称
if [ "$current_branch" = "next1" ]; then

bumpp --preid alpha --execute="$generateChangeLog" --commit "$commitInfo" --all --tag --push

else
echo "当前分支是:$current_branch ,版本迭代允许在next分之操作,并推送到远程!!!"
fi

0 comments on commit 249524e

Please sign in to comment.