Blame view

build.sh 988 Bytes
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
1
  #!/bin/bash
25bc1ab1   张志伟   🔥 feat(*): 调整打包命令
2
3
4
  
  set -e
  
4a128e13   张志伟   🚀 feat(*): 优化脚本新增校验
5
  current_branch=$(git rev-parse --abbrev-ref HEAD)
4a128e13   张志伟   🚀 feat(*): 优化脚本新增校验
6
7
  if [[ $current_branch != "test" ]]; then
    echo "当前不在 test 分支,脚本终止"
80447aa8   张志伟   🔥 feat(*): 优化命令
8
    exit 3
4a128e13   张志伟   🚀 feat(*): 优化脚本新增校验
9
10
  fi
  
165a9104   张志伟   🚀 feat(*): 优化脚本
11
12
13
14
  output=$(git pull --rebase)
  if echo "$output" | grep -q "Updating" && echo "$output" | grep -q "Fast-forward"; then
    echo "准备开始执行打包"
  else
064557e2   张志伟   🔥 feat(*): 调整打包脚本
15
16
    if [[ $1 != "true" ]]; then
      echo "无文件变动"
80447aa8   张志伟   🔥 feat(*): 优化命令
17
      exit 4
064557e2   张志伟   🔥 feat(*): 调整打包脚本
18
19
    fi
    echo "准备开始执行打包[强制]"
165a9104   张志伟   🚀 feat(*): 优化脚本
20
21
  fi
  
25bc1ab1   张志伟   🔥 feat(*): 调整打包命令
22
23
24
  mkdir -p target
  
  rm -rf target/*
25bc1ab1   张志伟   🔥 feat(*): 调整打包命令
25
  rm -rf dist
25bc1ab1   张志伟   🔥 feat(*): 调整打包命令
26
  
3e3c5ca2   张志伟   🎃 feat(*): 待办配置新增...
27
  echo "yes" | pnpm install --frozen-lockfile
25bc1ab1   张志伟   🔥 feat(*): 调整打包命令
28
  
ded405cc   张志伟   🍜 CI(*): 更新打包命令
29
  pnpm build:local
25bc1ab1   张志伟   🔥 feat(*): 调整打包命令
30
  
b747677a   张志伟   🚀 feat(*): 调整本地打包脚本
31
  mv dist/* target/
25bc1ab1   张志伟   🔥 feat(*): 调整打包命令
32
33
34
  
  git add .
  
165a9104   张志伟   🚀 feat(*): 优化脚本
35
36
37
38
39
  status=$(git status --porcelain)
  if [[ -n $status ]]; then
    echo "准备提交打包后的文件"
  else
    echo "本地没有文件变化"
80447aa8   张志伟   🔥 feat(*): 优化命令
40
    exit 4
165a9104   张志伟   🚀 feat(*): 优化脚本
41
42
  fi
  
915c2d76   张志伟   🚀 feat(*): 调整本地打包脚本
43
  timestamp=$(date +"%Y-%m-%d %H:%M:%S")
1c37e2ac   张志伟   🚀 feat(*): 使build...
44
  commit_message="📦 build(*): build [${timestamp}] "
f296d097   张志伟   🚀 feat(*): 调整本地打包脚本
45
  git commit -m "${commit_message}" -n
25bc1ab1   张志伟   🔥 feat(*): 调整打包命令
46
47
48
  
  git pull --rebase
  
188b4207   张志伟   🚀 feat(*): 优化本地打包脚本
49
50
51
  git push
  
  sleep 3
165a9104   张志伟   🚀 feat(*): 优化脚本
52
  curl https://testjenkins.feewee.cn/job/front.admin.feewee.cn/build?token=oKyioWCW