首页 > 解决方案 > 如何为 GIthub 操作 CICD 使用旧的服务器存储库路径(自托管)

问题描述

我有一个生产服务器,我已经有一个项目存储库。现在我已经为 CICD 设置了 github 操作。我已经给出了我的工作区路径,但它正在创建 2 个与我的仓库名称相同的子目录。Github 操作没有使用我的旧存储库,它正在再次克隆存储库。所以在服务器文件结构中我有 2 个相同的项目。现在我想在我的服务器目录中使用单个存储库。我的 yaml 代码如下所示 -

name: Node.js CI

on:
 push:
  branches: [ deploy ]
 pull_request:
  branches: [ deploy ]


jobs:
 build:

  runs-on: self-hosted
  strategy:
   matrix:
    node-version: [14.x]

    # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

 steps:
 - uses: actions/checkout@v2
 - name: Use Node.js ${{ matrix.node-version }}
   uses: actions/setup-node@v2
   with:
     node-version: ${{ matrix.node-version }}
     cache: 'npm'
 - run: npm i
 - run: npm run build:uat
   env:
     CI: false
 - run: rm -r /root/apps/frontend/build
 - run: mv /root/apps/frontend/frontend/build /root/apps/frontend/

标签: gitgithubyamldevopsgithub-actions

解决方案


推荐阅读