如何检出在 Bitbucket 管道中的上一步中推送的提交?

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

我有以下位桶管道:

  branches:
    develop:
      - step: *semantic_release # Performs git push 
      - step: *deploy           # Deploys the version before the push

我正在寻找一种方法来可靠地检出部署步骤中推送的提交(或只是分支的最新提交),你该怎么做?

我尝试了

git checkout $BITBUCKET_BRANCH
,但不起作用。

git bitbucket bitbucket-pipelines
1个回答
0
投票

如果您可以承受不将该发布提交合并到开发分支中的情况,那么一个零麻烦的解决方案可能是将其推送到发布分支。

pipelines:
  branches:
    develop:
      - step:
          name: semantic release
          script:
            - ./bump
            - git branch release/develop-$BITBUCKET_BUILD_NUMBER
            - git commit -m "bump"
            - git push origin release/develop-$BITBUCKET_BUILD_NUMBER
    release/develop-*:
      - step: *deploy

或者也许去寻找标签?

pipelines:
  branches:
    develop:
      - step:
          name: semantic release
          script:
            - ./bump
            - git commit -m "bump"
            - git tag v$BITBUCKET_BUILD_NUMBER
            - git push --tags origin develop
  tags:
    v*:
      - step: *deploy
© www.soinside.com 2019 - 2024. All rights reserved.