From 4e8b4ed77028efb6eb3dcc7e821fb9f6c793cfff Mon Sep 17 00:00:00 2001 From: Pavel Jbanov Date: Thu, 11 Jul 2024 10:49:57 -0400 Subject: [PATCH 1/3] chore: added a GHA for CLI version bumping and tagging --- .github/workflows/bump-cli-version.yml | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/bump-cli-version.yml diff --git a/.github/workflows/bump-cli-version.yml b/.github/workflows/bump-cli-version.yml new file mode 100644 index 0000000000..2f49e76beb --- /dev/null +++ b/.github/workflows/bump-cli-version.yml @@ -0,0 +1,58 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Bump and Tag CLI Version + +on: + workflow_dispatch: + inputs: + releaseType: + description: Release type + type: choice + default: patch + required: true + options: + - patch + - minor + - major + +jobs: + build: + name: Version bump + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v3 + - name: Set up node v20 + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: 'pnpm' + # bump version + - run: pnpm version ${{ inputs.releaseType }} + working-directory: ./genkit-tools/common + - run: pnpm version ${{ inputs.releaseType }} + working-directory: ./genkit-tools/cli + # commit new versions, tag and push + # assumption is that genkit and @genkit-ai/tools-common package versions are always in sync. + - name: Commit version bump + working-directory: ./genkit-tools/cli + run: | + CLI_VERSION=$(node -e "console.log(require('./package.json')['version'])") + git config --global user.name 'Genkit releaser' + git commit -am "chore: bump CLI version to $CLI_VERSION" + git tag genkit@$CLI_VERSION + git tag @genkit-ai/tools-common@$CLI_VERSION + git push + git push --tags From 3595e940f6af71d95d3d06d084e551ba43bd26be Mon Sep 17 00:00:00 2001 From: Pavel Jbanov Date: Thu, 11 Jul 2024 11:04:32 -0400 Subject: [PATCH 2/3] chore: commit version bumps to a branch and create a PR --- .github/workflows/bump-cli-version.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/bump-cli-version.yml b/.github/workflows/bump-cli-version.yml index 2f49e76beb..f4185178f7 100644 --- a/.github/workflows/bump-cli-version.yml +++ b/.github/workflows/bump-cli-version.yml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Bump and Tag CLI Version +name: Bump CLI Version on: workflow_dispatch: @@ -44,15 +44,15 @@ jobs: working-directory: ./genkit-tools/common - run: pnpm version ${{ inputs.releaseType }} working-directory: ./genkit-tools/cli - # commit new versions, tag and push + # commit new versions # assumption is that genkit and @genkit-ai/tools-common package versions are always in sync. - name: Commit version bump working-directory: ./genkit-tools/cli run: | CLI_VERSION=$(node -e "console.log(require('./package.json')['version'])") + BRANCH_NAME=releaser/cli-$CLI_VERSION git config --global user.name 'Genkit releaser' + git branch $BRANCH_NAME git commit -am "chore: bump CLI version to $CLI_VERSION" - git tag genkit@$CLI_VERSION - git tag @genkit-ai/tools-common@$CLI_VERSION - git push - git push --tags + git push $BRANCH_NAME + git request-pull origin/main $BRANCH_NAME From 63aa947c619d9377d2199fceb1bb6e666fa9db6c Mon Sep 17 00:00:00 2001 From: Pavel Jbanov Date: Thu, 11 Jul 2024 12:06:46 -0400 Subject: [PATCH 3/3] use phips28/gh-action-bump-version app --- .github/workflows/bump-cli-version.yml | 40 +++++++++++--------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/.github/workflows/bump-cli-version.yml b/.github/workflows/bump-cli-version.yml index f4185178f7..fad0a4a21d 100644 --- a/.github/workflows/bump-cli-version.yml +++ b/.github/workflows/bump-cli-version.yml @@ -32,27 +32,21 @@ jobs: name: Version bump runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v3 - - name: Set up node v20 - uses: actions/setup-node@v4 + - name: 'genkit-tools/common version bump' + uses: 'phips28/gh-action-bump-version@master' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PACKAGEJSON_DIR: genkit-tools/common with: - node-version: 20.x - cache: 'pnpm' - # bump version - - run: pnpm version ${{ inputs.releaseType }} - working-directory: ./genkit-tools/common - - run: pnpm version ${{ inputs.releaseType }} - working-directory: ./genkit-tools/cli - # commit new versions - # assumption is that genkit and @genkit-ai/tools-common package versions are always in sync. - - name: Commit version bump - working-directory: ./genkit-tools/cli - run: | - CLI_VERSION=$(node -e "console.log(require('./package.json')['version'])") - BRANCH_NAME=releaser/cli-$CLI_VERSION - git config --global user.name 'Genkit releaser' - git branch $BRANCH_NAME - git commit -am "chore: bump CLI version to $CLI_VERSION" - git push $BRANCH_NAME - git request-pull origin/main $BRANCH_NAME + default: ${{ inputs.releaseType }} + commit-message: 'chore: bump @genkit-ai/tools-common version to {{version}}' + tag-prefix: '@genkit-ai/tools-common@' + - name: 'genkit-tools/common version bump' + uses: 'phips28/gh-action-bump-version@master' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PACKAGEJSON_DIR: genkit-tools/cli + with: + default: ${{ inputs.releaseType }} + commit-message: 'chore: bump CLI version to {{version}}' + tag-prefix: 'genkit@'