diff --git a/.gcb/format.yaml b/.gcb/format.yaml index c1155ea785..9297ba7432 100644 --- a/.gcb/format.yaml +++ b/.gcb/format.yaml @@ -103,7 +103,7 @@ steps: go install github.com/google/yamlfmt/cmd/yamlfmt@v0.13.0 git ls-files -z -- '*.yaml' '*.yml' ':!:testdata/**' ':!:**/generated/**' ':!:librarian.yaml' | \ xargs -0 yamlfmt - V=$(cat .librarian-version.txt) + V=$(sed -n 's/^version: *//p' librarian.yaml) go run github.com/googleapis/librarian/cmd/librarian@${V} tidy waitFor: ['-'] env: diff --git a/.gcb/scripts/regenerate.sh b/.gcb/scripts/regenerate.sh index fc1979f730..f78c1fb4d0 100755 --- a/.gcb/scripts/regenerate.sh +++ b/.gcb/scripts/regenerate.sh @@ -35,7 +35,7 @@ rustup component add rustfmt rustup show active-toolchain -v echo "Regenerate all the code" -version=$(cat /workspace/.librarian-version.txt) +version=$(sed -n 's/^version: *//p' /workspace/librarian.yaml) go run github.com/googleapis/librarian/cmd/librarian@${version} generate --all # If there is any difference between the generated code and the diff --git a/.librarian-version.txt b/.librarian-version.txt deleted file mode 100644 index 991f3f1558..0000000000 --- a/.librarian-version.txt +++ /dev/null @@ -1 +0,0 @@ -v0.8.1-0.20260204230000-ecb27d3ef03a diff --git a/doc/contributor/howto-guide-generated-code-maintenance.md b/doc/contributor/howto-guide-generated-code-maintenance.md index a429e3cb02..bc7e8058ae 100644 --- a/doc/contributor/howto-guide-generated-code-maintenance.md +++ b/doc/contributor/howto-guide-generated-code-maintenance.md @@ -32,7 +32,7 @@ You need to look at the [API list] for the pinned version of librarian, if the API is not in the list: 1. Send a PR adding the API to librarian. -1. Send a PR to update `.librarian-version.txt`. +1. Send a PR to update the `version` field in `librarian.yaml`. ### Generate @@ -53,7 +53,7 @@ This command will generate the library, add the library to Cargo and git, and run the necessary tests: ```bash -V=$(cat .librarian-version.txt) +V=$(sed -n 's/^version: *//p' librarian.yaml) # add library to librarian.yaml go run github.com/googleapis/librarian/cmd/librarian@${V} add ${library} # generate library @@ -73,7 +73,7 @@ Run: ```bash git checkout -b chore-update-shas-circa-$(date +%Y-%m-%d) -V=$(cat .librarian-version.txt) +V=$(sed -n 's/^version: *//p' librarian.yaml) go run github.com/googleapis/librarian/cmd/librarian@${V} update discovery go run github.com/googleapis/librarian/cmd/librarian@${V} update googleapis go run github.com/googleapis/librarian/cmd/librarian@${V} generate --all @@ -108,7 +108,7 @@ Run: ```bash git fetch upstream git checkout -b chore-bump-version-numbers-circa-$(date +%Y-%m-%d) -V=$(cat .librarian-version.txt) +V=$(sed -n 's/^version: *//p' librarian.yaml) go run github.com/googleapis/librarian/cmd/librarian@${V} bump --all go run github.com/googleapis/librarian/cmd/librarian@${V} generate --all # It is safe to commit everything because `bump` stops you from updating a @@ -210,7 +210,7 @@ Commit all these changes and send a PR. Run: ```bash -V=$(cat .librarian-version.txt) +V=$(sed -n 's/^version: *//p' librarian.yaml) go run github.com/googleapis/librarian/cmd/librarian@${V} generate --all ``` @@ -224,7 +224,7 @@ the library name from librarian.yaml. Run: ```bash -V=$(cat .librarian-version.txt) +V=$(sed -n 's/^version: *//p' librarian.yaml) go run github.com/googleapis/librarian/cmd/librarian@${V} generate google-cloud-secretmanager-v1 ``` @@ -234,7 +234,7 @@ Someday `librarian` will be stable enough that we will be able to install it. At that point we will be able to say: ```bash -V=$(cat .librarian-version.txt) +V=$(sed -n 's/^version: *//p' librarian.yaml) go install github.com/googleapis/librarian/cmd/librarian@${V} ``` @@ -271,18 +271,17 @@ Wait for the PR to be approved and merged. Then finish your PR in `google-cloud-rust`. -1. Update the default librarian version: +1. Update the librarian version in `librarian.yaml`: ```bash - GOPROXY=direct go list -m -u -f '{{.Version}}' github.com/googleapis/librarian@main >.librarian-version.txt - V=$(cat .librarian-version.txt) - sed -i.bak "s;^version: .*;version: ${V};" librarian.yaml + V=$(GOPROXY=direct go list -m -f '{{.Version}}' github.com/googleapis/librarian@main) + sed -i.bak "s;^version: .*;version: ${V};" librarian.yaml && rm librarian.yaml.bak ``` 1. Update the generated code: ```bash - V=$(cat .librarian-version.txt) + V=$(sed -n 's/^version: *//p' librarian.yaml) go run github.com/googleapis/librarian/cmd/librarian@${V} generate --all ``` @@ -319,7 +318,7 @@ example: ``` bash -V=$(cat .librarian-version.txt) +V=$(sed -n 's/^version: *//p' librarian.yaml) go run github.com/googleapis/librarian/cmd/librarian@${V} generate google-cloud-apps-script-type ```