From fdbd99885268e0466fd8074686fb6f38af12c652 Mon Sep 17 00:00:00 2001 From: ShanYi-Hui Date: Fri, 26 Apr 2024 08:51:22 +0800 Subject: [PATCH] Update auto-deploy.yml Debug --- .github/workflows/auto-deploy.yml | 118 +++++++++++++++--------------- 1 file changed, 61 insertions(+), 57 deletions(-) diff --git a/.github/workflows/auto-deploy.yml b/.github/workflows/auto-deploy.yml index 4a80fcf0..87797751 100644 --- a/.github/workflows/auto-deploy.yml +++ b/.github/workflows/auto-deploy.yml @@ -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/*