Skip to content

Commit

Permalink
Update auto-deploy.yml
Browse files Browse the repository at this point in the history
Debug
  • Loading branch information
ShanYi-Hui authored Apr 26, 2024
1 parent 5185390 commit fdbd998
Showing 1 changed file with 61 additions and 57 deletions.
118 changes: 61 additions & 57 deletions .github/workflows/auto-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,75 +35,79 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

# 建一个名为setup-node的步骤(安装指定版本的Node.js)
- name: setup-node
# 使用setup-node@v3这个action
uses: actions/setup-node@v4
# 指定某个action 可能需要输入的参数
with:
node-version: '18.12.1'

# 安装依赖
- name: Install dependencies
run: npm install
# 打包
- name: Build application 🔧
run: npm run build github

# 部署 https://github.com/JamesIves/github-pages-deploy-action
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
with:
token: ${{ secrets.MB_ADMIN_TOKEN }}
branch: gh-pages # default: gh-pages
folder: dist-github
clean: true # Automatically remove deleted files from the deploy branch
# commit-message: ${{ github.event.head_commit.message }} # default: `Deploying to gh-pages from @ 3238feb 🚀`
# commit-message: "deploy: ${{ github.sha }} (${{ github.event.head_commit.message }}) 🚀 "
# # 建一个名为setup-node的步骤(安装指定版本的Node.js)
# - name: setup-node
# # 使用setup-node@v3这个action
# uses: actions/setup-node@v4
# # 指定某个action 可能需要输入的参数
# with:
# node-version: '18.12.1'

# # 安装依赖
# - name: Install dependencies
# run: npm install
# # 打包
# - name: Build application 🔧
# run: npm run build github

# # 部署 https://github.com/JamesIves/github-pages-deploy-action
# - name: Deploy 🚀
# uses: JamesIves/github-pages-deploy-action@v4
# if: github.ref == 'refs/heads/main'
# with:
# token: ${{ secrets.MB_ADMIN_TOKEN }}
# branch: gh-pages # default: gh-pages
# folder: dist-github
# clean: true # Automatically remove deleted files from the deploy branch
# # commit-message: ${{ github.event.head_commit.message }} # default: `Deploying to gh-pages from @ 3238feb 🚀`
# # commit-message: "deploy: ${{ github.sha }} (${{ github.event.head_commit.message }}) 🚀 "
sync-to-gitee:
# github 构建部署成功后触发
needs: build-and-deploy
runs-on: ubuntu-latest
steps:
# 官方action,将代码拉取到虚拟机
- name: Checkout
uses: actions/checkout@v4

# 建一个名为setup-node的步骤(安装指定版本的Node.js)
- name: setup-node
# 使用setup-node@v3这个action
uses: actions/setup-node@v4
# 指定某个action 可能需要输入的参数
with:
node-version: '18.12.1'

# 安装依赖
- name: Install dependencies
run: npm install

# 打包
- name: Build application
run: npm run build gitee

# 部署 https://github.com/JamesIves/github-pages-deploy-action
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
with:
token: ${{ secrets.MB_ADMIN_TOKEN }}
branch: gh-pages-gitee # default: gh-pages
folder: dist-gitee
clean: true # Automatically remove deleted files from the deploy branch
# commit-message: ${{ github.event.head_commit.message }} # default: `Deploying to gh-pages from @ 3238feb 🚀`
# commit-message: "deploy: ${{ github.sha }} (${{ github.event.head_commit.message }}) 🚀 "
# # 官方action,将代码拉取到虚拟机
# - name: Checkout
# uses: actions/checkout@v4

# # 建一个名为setup-node的步骤(安装指定版本的Node.js)
# - name: setup-node
# # 使用setup-node@v3这个action
# uses: actions/setup-node@v4
# # 指定某个action 可能需要输入的参数
# with:
# node-version: '18.12.1'

# # 安装依赖
# - name: Install dependencies
# run: npm install

# # 打包
# - name: Build application
# run: npm run build gitee

# # 部署 https://github.com/JamesIves/github-pages-deploy-action
# - name: Deploy 🚀
# uses: JamesIves/github-pages-deploy-action@v4
# if: github.ref == 'refs/heads/main'
# with:
# token: ${{ secrets.MB_ADMIN_TOKEN }}
# branch: gh-pages-gitee # default: gh-pages
# folder: dist-gitee
# clean: true # Automatically remove deleted files from the deploy branch
# # commit-message: ${{ github.event.head_commit.message }} # default: `Deploying to gh-pages from @ 3238feb 🚀`
# # commit-message: "deploy: ${{ github.sha }} (${{ github.event.head_commit.message }}) 🚀 "

- name: Set SSH Environment
env:
GITEE_RSA_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }}
run: |
echo $GITEE_RSA_PRIVATE_KEY
ssh-keygen -l -f $GITEE_RSA_PRIVATE_KEY
mkdir -p ~/.ssh/
echo "$GITEE_RSA_PRIVATE_KEY" > ~/.ssh/id_rsa
cat ~/.ssh/id_rsa
cat /root/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com > ~/.ssh/known_hosts
chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
Expand Down

0 comments on commit fdbd998

Please sign in to comment.