From 50c7794625be00ef8b8870e1c9ed8e22fa44c7ed Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Fri, 19 Sep 2025 00:05:23 +0530 Subject: [PATCH 1/3] ci: setup packaging and releasing --- .github/workflows/release-please.yml | 16 ++++ .release-please-manifest.json | 3 + gemini-extension.json | 2 +- package-and-upload-assets.yml | 136 +++++++++++++++++++++++++++ release-please-config.json | 23 +++++ toolbox_version.txt | 1 + 6 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release-please.yml create mode 100644 .release-please-manifest.json create mode 100644 package-and-upload-assets.yml create mode 100644 release-please-config.json create mode 100644 toolbox_version.txt diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..63065c1 --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,16 @@ +# Copyright 2025 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. + +handleGHRelease: true +manifest: true \ No newline at end of file diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..46b1b67 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.0" +} \ No newline at end of file diff --git a/gemini-extension.json b/gemini-extension.json index 24c671f..e6017a9 100644 --- a/gemini-extension.json +++ b/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "cloud-sql-sqlserver", - "version": "0.1.0", + "version": "0.0.0", "description": "Connect to Cloud SQL for SQL Server", "mcpServers": { "Cloud SQL for SQL Server": { diff --git a/package-and-upload-assets.yml b/package-and-upload-assets.yml new file mode 100644 index 0000000..39ac618 --- /dev/null +++ b/package-and-upload-assets.yml @@ -0,0 +1,136 @@ +# Copyright 2025 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: Package and Upload Release Assets + +# Global variables +env: + PACKAGE_NAME: "alloydb" + FILES_TO_PACKAGE: "gemini-extension.json ALLOYDB.md LICENSE" + GCS_BUCKET_URL: "https://storage.googleapis.com/genai-toolbox" + +on: + release: + types: [created] + +jobs: + package: + name: Package for ${{ matrix.platform.os }}-${{ matrix.platform.arch }} + runs-on: ubuntu-latest + + strategy: + matrix: + platform: + - { os: "linux", arch: "x64", download_path_segment: "linux/amd64/toolbox-extensions", binary_suffix: "", archive_extension: "tar.gz", archive_command: 'tar -czvf "${ARCHIVE_NAME}" -C staging .' } + - { os: "darwin", arch: "arm64", download_path_segment: "darwin/arm64/toolbox-extensions", binary_suffix: "", archive_extension: "tar.gz", archive_command: 'tar -czvf "${ARCHIVE_NAME}" -C staging .' } + - { os: "darwin", arch: "x64", download_path_segment: "darwin/amd64/toolbox-extensions", binary_suffix: "", archive_extension: "tar.gz", archive_command: 'tar -czvf "${ARCHIVE_NAME}" -C staging .' } + - { os: "win32", arch: "x64", download_path_segment: "windows/amd64/toolbox-extensions.exe", binary_suffix: ".exe", archive_extension: "zip", archive_command: '(cd staging && zip ../"${ARCHIVE_NAME}" *)' } + + steps: + - name: Checkout code at the new tag + uses: actions/checkout@v4 + with: + ref: ${{ github.event.release.tag_name }} + + - name: Set Dynamic Environment Variables + id: vars + run: | + echo "archive_name=${{ matrix.platform.os }}.${{ matrix.platform.arch }}.${{ env.PACKAGE_NAME }}.${{ matrix.platform.archive_extension }}" >> $GITHUB_OUTPUT + echo "target_binary=toolbox${{ matrix.platform.binary_suffix }}" >> $GITHUB_OUTPUT + + - name: Get Toolbox Version + id: get_toolbox_version + run: | + TOOLBOX_VERSION=$(cat toolbox_version.txt) + echo "Found toolbox version: ${TOOLBOX_VERSION}" + echo "TOOLBOX_VERSION=${TOOLBOX_VERSION}" >> $GITHUB_OUTPUT + + - name: Download Source Binary + env: + TOOLBOX_VERSION: ${{ steps.get_toolbox_version.outputs.TOOLBOX_VERSION }} + DOWNLOAD_PATH_SEGMENT: ${{ matrix.platform.download_path_segment }} + run: | + DOWNLOAD_URL="${GCS_BUCKET_URL}/v${TOOLBOX_VERSION}/${DOWNLOAD_PATH_SEGMENT}" + + echo "Downloading binary from: ${DOWNLOAD_URL}" + curl -L --fail -o "${target_binary}" "${DOWNLOAD_URL}" + + echo "Binary downloaded and prepared." + ls -l + + - name: Create release archive + id: create_archive + env: + ARCHIVE_COMMAND: ${{ matrix.platform.archive_command }} + ARCHIVE_NAME: ${{ steps.vars.outputs.archive_name }} + target_binary: ${{ steps.vars.outputs.target_binary }} + run: | + ARCHIVE_NAME="${{ matrix.platform.os }}.${{ matrix.platform.arch }}.${PACKAGE_NAME}.${{ matrix.platform.archive_extension }}" + target_binary="toolbox${{ matrix.platform.binary_suffix }}" + + echo "Packaging ${target_binary} into ${ARCHIVE_NAME}" + + mkdir staging + cp "${target_binary}" "staging/${target_binary}" + cp ${FILES_TO_PACKAGE} staging/ + + if [[ "${{ matrix.platform.os }}" == "win32" ]]; then + echo "Modifying gemini-extension.json for Windows..." + jq '(.mcpServers[].command) |= sub("toolbox$"; "toolbox.exe")' gemini-extension.json > staging/gemini-extension.json + echo "Modification complete." + fi + + echo "All assets staged." + ls -l staging + + # Create archive + eval "${ARCHIVE_COMMAND}" + echo "Created archive: ${ARCHIVE_NAME}" + echo "ARCHIVE_PATH=${ARCHIVE_NAME}" >> $GITHUB_OUTPUT + + - name: Upload archive as workflow artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ steps.vars.outputs.archive_name }} + path: ${{ steps.create_archive.outputs.ARCHIVE_PATH }} + + # This job gathers all archives and uploads them to the GitHub Release. + upload: + name: Upload all assets to release + runs-on: ubuntu-latest + needs: package + permissions: + contents: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download all archives from workflow artifacts + uses: actions/download-artifact@v4 + with: + path: release-archives + + - name: List downloaded files + run: | + echo "--- Downloaded files ---" + ls -R release-archives + echo "------------------------" + + - name: Upload all assets to GitHub Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release upload \ + ${{ github.event.release.tag_name }} \ + release-archives/*/* diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..ab640fe --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,23 @@ +{ + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "changelog-sections": [ + { "type": "feat", "section": "Features" }, + { "type": "fix", "section": "Bug Fixes" }, + { "type": "chore", "section": "Miscellaneous Chores", "hidden": false }, + { "type": "docs", "section": "Documentation", "hidden": false } + ], + "packages": { + ".": { + "release-type": "simple", + "package-name": "alloydb", + "extra-files": [ + { + "type": "json", + "path": "gemini-extension.json", + "jsonpath": "$.version" + } + ] + } + } +} \ No newline at end of file diff --git a/toolbox_version.txt b/toolbox_version.txt new file mode 100644 index 0000000..7092c7c --- /dev/null +++ b/toolbox_version.txt @@ -0,0 +1 @@ +0.15.0 \ No newline at end of file From eb96de7a9e15be87382826d774abcdf9063e328e Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Fri, 19 Sep 2025 00:07:43 +0530 Subject: [PATCH 2/3] fix names and paths --- .github/{workflows => }/release-please.yml | 0 .../workflows/package-and-upload-assets.yml | 4 ++-- release-please-config.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename .github/{workflows => }/release-please.yml (100%) rename package-and-upload-assets.yml => .github/workflows/package-and-upload-assets.yml (97%) diff --git a/.github/workflows/release-please.yml b/.github/release-please.yml similarity index 100% rename from .github/workflows/release-please.yml rename to .github/release-please.yml diff --git a/package-and-upload-assets.yml b/.github/workflows/package-and-upload-assets.yml similarity index 97% rename from package-and-upload-assets.yml rename to .github/workflows/package-and-upload-assets.yml index 39ac618..46a6f25 100644 --- a/package-and-upload-assets.yml +++ b/.github/workflows/package-and-upload-assets.yml @@ -16,8 +16,8 @@ name: Package and Upload Release Assets # Global variables env: - PACKAGE_NAME: "alloydb" - FILES_TO_PACKAGE: "gemini-extension.json ALLOYDB.md LICENSE" + PACKAGE_NAME: "cloud-sql-sqlserver" + FILES_TO_PACKAGE: "gemini-extension.json CLOUD-SQL-SQLSERVER.md LICENSE" GCS_BUCKET_URL: "https://storage.googleapis.com/genai-toolbox" on: diff --git a/release-please-config.json b/release-please-config.json index ab640fe..56c9cfa 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -10,7 +10,7 @@ "packages": { ".": { "release-type": "simple", - "package-name": "alloydb", + "package-name": "cloud-sql-sqlserver", "extra-files": [ { "type": "json", From a8c3ac52f686360920133110d81b2e655d2f4cef Mon Sep 17 00:00:00 2001 From: Twisha Bansal <58483338+twishabansal@users.noreply.github.com> Date: Fri, 19 Sep 2025 00:42:03 +0530 Subject: [PATCH 3/3] update naming convention --- .../workflows/package-and-upload-assets.yml | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/package-and-upload-assets.yml b/.github/workflows/package-and-upload-assets.yml index 46a6f25..e1487bd 100644 --- a/.github/workflows/package-and-upload-assets.yml +++ b/.github/workflows/package-and-upload-assets.yml @@ -18,7 +18,7 @@ name: Package and Upload Release Assets env: PACKAGE_NAME: "cloud-sql-sqlserver" FILES_TO_PACKAGE: "gemini-extension.json CLOUD-SQL-SQLSERVER.md LICENSE" - GCS_BUCKET_URL: "https://storage.googleapis.com/genai-toolbox" + GCS_BUCKET_URL: "https://storage.googleapis.com/genai-toolbox/geminicli" on: release: @@ -32,10 +32,10 @@ jobs: strategy: matrix: platform: - - { os: "linux", arch: "x64", download_path_segment: "linux/amd64/toolbox-extensions", binary_suffix: "", archive_extension: "tar.gz", archive_command: 'tar -czvf "${ARCHIVE_NAME}" -C staging .' } - - { os: "darwin", arch: "arm64", download_path_segment: "darwin/arm64/toolbox-extensions", binary_suffix: "", archive_extension: "tar.gz", archive_command: 'tar -czvf "${ARCHIVE_NAME}" -C staging .' } - - { os: "darwin", arch: "x64", download_path_segment: "darwin/amd64/toolbox-extensions", binary_suffix: "", archive_extension: "tar.gz", archive_command: 'tar -czvf "${ARCHIVE_NAME}" -C staging .' } - - { os: "win32", arch: "x64", download_path_segment: "windows/amd64/toolbox-extensions.exe", binary_suffix: ".exe", archive_extension: "zip", archive_command: '(cd staging && zip ../"${ARCHIVE_NAME}" *)' } + - { os: "linux", arch: "x64", download_path_segment: "linux/amd64", binary_suffix: "", archive_extension: "tar.gz", archive_command: 'tar -czvf "${ARCHIVE_NAME}" -C staging .' } + - { os: "darwin", arch: "arm64", download_path_segment: "darwin/arm64", binary_suffix: "", archive_extension: "tar.gz", archive_command: 'tar -czvf "${ARCHIVE_NAME}" -C staging .' } + - { os: "darwin", arch: "x64", download_path_segment: "darwin/amd64", binary_suffix: "", archive_extension: "tar.gz", archive_command: 'tar -czvf "${ARCHIVE_NAME}" -C staging .' } + - { os: "win32", arch: "x64", download_path_segment: "windows/amd64", binary_suffix: ".exe", archive_extension: "zip", archive_command: '(cd staging && zip ../"${ARCHIVE_NAME}" *)' } steps: - name: Checkout code at the new tag @@ -47,7 +47,7 @@ jobs: id: vars run: | echo "archive_name=${{ matrix.platform.os }}.${{ matrix.platform.arch }}.${{ env.PACKAGE_NAME }}.${{ matrix.platform.archive_extension }}" >> $GITHUB_OUTPUT - echo "target_binary=toolbox${{ matrix.platform.binary_suffix }}" >> $GITHUB_OUTPUT + echo "source_binary=toolbox${{ matrix.platform.binary_suffix }}" >> $GITHUB_OUTPUT - name: Get Toolbox Version id: get_toolbox_version @@ -60,11 +60,12 @@ jobs: env: TOOLBOX_VERSION: ${{ steps.get_toolbox_version.outputs.TOOLBOX_VERSION }} DOWNLOAD_PATH_SEGMENT: ${{ matrix.platform.download_path_segment }} + SOURCE_BINARY: ${{ steps.vars.outputs.source_binary }} run: | - DOWNLOAD_URL="${GCS_BUCKET_URL}/v${TOOLBOX_VERSION}/${DOWNLOAD_PATH_SEGMENT}" + DOWNLOAD_URL="${GCS_BUCKET_URL}/v${TOOLBOX_VERSION}/${DOWNLOAD_PATH_SEGMENT}/${SOURCE_BINARY}" echo "Downloading binary from: ${DOWNLOAD_URL}" - curl -L --fail -o "${target_binary}" "${DOWNLOAD_URL}" + curl -L --fail -o "${SOURCE_BINARY}" "${DOWNLOAD_URL}" echo "Binary downloaded and prepared." ls -l @@ -74,15 +75,15 @@ jobs: env: ARCHIVE_COMMAND: ${{ matrix.platform.archive_command }} ARCHIVE_NAME: ${{ steps.vars.outputs.archive_name }} - target_binary: ${{ steps.vars.outputs.target_binary }} + SOURCE_BINARY: ${{ steps.vars.outputs.source_binary }} run: | ARCHIVE_NAME="${{ matrix.platform.os }}.${{ matrix.platform.arch }}.${PACKAGE_NAME}.${{ matrix.platform.archive_extension }}" - target_binary="toolbox${{ matrix.platform.binary_suffix }}" + SOURCE_BINARY="toolbox${{ matrix.platform.binary_suffix }}" - echo "Packaging ${target_binary} into ${ARCHIVE_NAME}" + echo "Packaging ${SOURCE_BINARY} into ${ARCHIVE_NAME}" mkdir staging - cp "${target_binary}" "staging/${target_binary}" + cp "${SOURCE_BINARY}" "staging/${SOURCE_BINARY}" cp ${FILES_TO_PACKAGE} staging/ if [[ "${{ matrix.platform.os }}" == "win32" ]]; then