Bitbucket 管道中的 JSON 值替换

sea*_*717 1 bitbucket-pipelines

我有一个 JSON 文件“appSettings.json”,其中包含以下内容:

{
  "Branch": {
    "Name": "test"
  },
}
Run Code Online (Sandbox Code Playgroud)

我的问题是,运行 bitbucket 管道时如何将值“Branch.Name”设置为其他值?

sea*_*717 5

检查完这个问题后就明白了。

- apt-get update
- apt-get install -y jq # install jq
- tmp=$(mktemp)
- jq '.Branch.Name = "prod"' appsettings.json > "$tmp" && mv "$tmp" appsettings.json
Run Code Online (Sandbox Code Playgroud)