如何使用Github操作保存构建文件(React)

问题描述 投票:0回答:1

我正在尝试使用github动作来构建React代码。但是在成功构建文件之后,我想将其保存在特定位置,在存储库中说“ build”文件夹。我目前能够构建文件,但无法将其保存在存储库中

reactjs continuous-integration cd github-actions
1个回答
0
投票

如果您想在工作流中尝试将构建工件自己提交回存储库,请参阅以下有关如何准备存储库和git config的答案。

Tagging, and building and uploading a python library

或者,您可能会发现create-pull-request操作对此用例有用。它将对“动作”工作区的更改提交到新分支,并提出拉取请求。因此,如果在工作流期间创建工件后调用create-pull-request操作,则可以将该更改作为PR提出,以供您查看和合并。

例如:

on: push
name: Update Version
jobs:
  createPullRequest:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      ...
      (your build steps)
      ...
      - name: Create Pull Request
        uses: peter-evans/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          COMMIT_MESSAGE: Add build artifact
          PULL_REQUEST_TITLE: Add build artifact
© www.soinside.com 2019 - 2024. All rights reserved.