Skip to content

Commit

Permalink
更新自动化部署脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
jywangyou committed Dec 16, 2023
1 parent 3123cb2 commit ef7f848
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 80 deletions.
57 changes: 4 additions & 53 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,3 @@
# name: CI

# #on: [push]

# # 在master分支发生push事件时触发。
# on:
# push:
# branches:
# - master

# env: # 设置环境变量
# TZ: Asia/Shanghai # 时区(设置时区可使页面中的`最近更新时间`使用该时区时间)

# jobs:
# build: # 自定义名称
# runs-on: ubuntu-latest # 运行在虚拟机环境ubuntu-latest

# strategy:
# matrix:
# node-version: [18.x]

# steps:
# - name: Checkout # 步骤1
# uses: actions/checkout@v1 # 使用的动作。格式:userName/repoName。作用:检出仓库,获取源码。 官方actions库:https://github.com/actions
# - name: Use Node.js ${{ matrix.node-version }} # 步骤2
# uses: actions/setup-node@v3 # 作用:安装nodejs
# with:
# node-version: ${{ matrix.node-version }} # 版本
# - name: Build-and-deploy # 步骤3
# run: |
# remote_addr=`git remote get-url --push origin`
# commit_info=`git describe --all --always --long`
# user_name=`git log -1 --pretty=format:'%an'`
# user_email=`git log -1 --pretty=format:'%ae'`
# deploy_branch=gh-pages
# yarn
# yarn build
# cd docs/.vuepress/dist
# git config --global init.defaultBranch $deploy_branch
# git init
# git config user.name ${user_name}
# git config user.email ${user_email}
# git add -A
# git commit -m "auto deploy, $commit_info"
# remote_addr=`echo $remote_addr | awk -F'://' '{print $2}'`
# remote_addr=https://${user_name}:${{secrets.GITHUB_TOKEN}}@${remote_addr}
# git remote add origin ${remote_addr}
# git push origin HEAD:$deploy_branch --force # 推送到github $deploy_branch分支




name: CI

#on: [push]
Expand Down Expand Up @@ -85,7 +33,10 @@ jobs: # 工作流
env: # 设置环境变量,未设置则不运行
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} # token
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} # 私钥
run: npm install && npm run deploy # 执行 deploy.sh 脚本,位于项目根目录
run: |
cd $GITHUB_WORKSPACE
npm install
npm run deploy
# - name: Push Matser To Gitee # 步骤4:GitHub 内容同步到 Gitee,同步仓库是 master
# uses: wearerequired/git-mirror-action@master
Expand Down
27 changes: 0 additions & 27 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
# #!/usr/bin/env sh

# # 确保脚本抛出遇到的错误
# set -e


# push_addr=`git remote get-url --push origin` # git提交地址,也可以手动设置,比如:[email protected]:xugaoyi/vuepress-theme-vdoing.git
# commit_info=`git describe --all --always --long`
# dist_path=docs/.vuepress/dist # 打包生成的文件夹路径
# push_branch=gh-pages # 推送的分支

# # 生成静态文件
# npm run build

# # 进入生成的文件夹
# cd $dist_path

# git init
# git add -A
# git commit -m "deploy, $commit_info"
# git push -f $push_addr HEAD:$push_branch

# cd -
# rm -rf $dist_path



#!/usr/bin/env sh

# 确保脚本抛出遇到的错误
Expand Down

0 comments on commit ef7f848

Please sign in to comment.