如何在github操作中将代码部署到同一个存储库的不同分支?

fcwjkofz  于 2022-11-20  发布在  Git
关注(0)|答案(1)|浏览(146)

我需要在一个分支中构建一些文件,然后使用github操作将新形成和更新的文件推到同一个存储库的另一个分支。我已经尝试过这种方法,但在commit to staging branch时总是失败

name: Deployment

on:
  push:
    branches: [ develop ]
  pull_request:
    branches: [ develop ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - name: Build files and folders
      run: |
        ./build.sh
        rm -rf cache
        mkdir logs
        cd logs
        ls>output.txt
    - name: commit to staging 
      run: |
        git checkout staging
        git add *
        git commit -m "new push to staging"
        git push

错误

/home/runner/work/_temp/c305681-ab7e-42f8-b39c-8ef35264cff.sh: line 1: github: command not found
Error: Process completed with exit code 127
hfyxw5xn

hfyxw5xn1#

默认情况下,actions/checkout只提取一个提交,不提取其他分支。

git fetch origin staging:staging

然后再检查。

相关问题