Azure DevOps - 提交到发布管道上的 Bitbucket 存储库更新文件?
Azure DevOps - commit to Bitbucket repository updated file on release pipeline?
我有一个 npm 源代码需要构建并推送到 npmjs 存储库。详细情况如下:
构建管道:
1) Get sources from Bitbucket repository
2) Get from package.json version number (ex. 0.0.3), increase it by 0.0.1 (0.0.4) and add this value to build variables $(version)
3) Make NPM install and build.
4) Take package-0.0.4.tgz and package.json to the artifacts folder and publish it.
发布渠道:
1) Download artifacts
2) Extract package-0.0.4.tgz to npm-publish folder
3) Copy package.json to npm-publish folder
4) Publish npm folder to npmjs repository.
我的问题 - 是否可以在发布到 npmjs 存储库后将新版本的 package.json 文件提交到 Bitbucket 存储库?
可以提交到 Bitbucket 存储库。你只需要添加一个脚本任务来执行git命令。
对于下面的例子。我将 powershell 任务添加到管道中命令下方的 运行 以提交更改并推送到 Bitbucket 存储库。
- powershell: |
git config --global user.email "you@example.com"
git config --global user.name "user.name"
#echo "some-text" > filename.txt
git add .
git commit -m "update package version"
git push https://username:password@bitbucket.org/name/repo.git HEAD:master -q
#if your password or username contain @ replace it with %40
displayName: 'push to bitbucket'
我有一个 npm 源代码需要构建并推送到 npmjs 存储库。详细情况如下:
构建管道:
1) Get sources from Bitbucket repository
2) Get from package.json version number (ex. 0.0.3), increase it by 0.0.1 (0.0.4) and add this value to build variables $(version)
3) Make NPM install and build.
4) Take package-0.0.4.tgz and package.json to the artifacts folder and publish it.
发布渠道:
1) Download artifacts
2) Extract package-0.0.4.tgz to npm-publish folder
3) Copy package.json to npm-publish folder
4) Publish npm folder to npmjs repository.
我的问题 - 是否可以在发布到 npmjs 存储库后将新版本的 package.json 文件提交到 Bitbucket 存储库?
可以提交到 Bitbucket 存储库。你只需要添加一个脚本任务来执行git命令。
对于下面的例子。我将 powershell 任务添加到管道中命令下方的 运行 以提交更改并推送到 Bitbucket 存储库。
- powershell: |
git config --global user.email "you@example.com"
git config --global user.name "user.name"
#echo "some-text" > filename.txt
git add .
git commit -m "update package version"
git push https://username:password@bitbucket.org/name/repo.git HEAD:master -q
#if your password or username contain @ replace it with %40
displayName: 'push to bitbucket'