From 28b38d6a01d6823037a00c93d2ee4d6dac119e4d Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Mon, 6 Nov 2023 12:58:58 -0500 Subject: [PATCH 1/5] add @spruce release to version.json and incorporate in user-agent --- src/utils/user-agent.ts | 5 +++++ src/version.json | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/user-agent.ts b/src/utils/user-agent.ts index 4e291263..eddac888 100644 --- a/src/utils/user-agent.ts +++ b/src/utils/user-agent.ts @@ -10,6 +10,11 @@ export const buildUserAgent = (isLegacy: boolean) => { 'lang=typescript', ]; + // If the @spruce release is in use, add that to the user agent + if (packageInfo.release) { + userAgentParts.push(`release=${packageInfo.release}`); + } + if (isEdge()) { userAgentParts.push('Edge Runtime'); } diff --git a/src/version.json b/src/version.json index adc962b9..793d151d 100644 --- a/src/version.json +++ b/src/version.json @@ -1,4 +1,5 @@ { "name": "@pinecone-database/pinecone", - "version": "1.1.2" + "version": "1.1.2", + "release": "@spruce" } From 065cedbf5d60c1e70a3c6387be8e0749048753d2 Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Tue, 7 Nov 2023 15:06:12 -0500 Subject: [PATCH 2/5] remove release version from version.json and instead rely on environment variable --- src/utils/user-agent.ts | 12 +++++++++--- src/version.json | 3 +-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/utils/user-agent.ts b/src/utils/user-agent.ts index eddac888..8d06c05d 100644 --- a/src/utils/user-agent.ts +++ b/src/utils/user-agent.ts @@ -10,9 +10,15 @@ export const buildUserAgent = (isLegacy: boolean) => { 'lang=typescript', ]; - // If the @spruce release is in use, add that to the user agent - if (packageInfo.release) { - userAgentParts.push(`release=${packageInfo.release}`); + // If there is a PINECONE_RELEASE_VERSION environment variable + // set append to the user agent + if ( + typeof process !== 'undefined' && + process && + process.env && + process.env.PINECONE_RELEASE_VERSION + ) { + userAgentParts.push(`release=${process.env.PINECONE_RELEASE_VERSION}`); } if (isEdge()) { diff --git a/src/version.json b/src/version.json index 793d151d..adc962b9 100644 --- a/src/version.json +++ b/src/version.json @@ -1,5 +1,4 @@ { "name": "@pinecone-database/pinecone", - "version": "1.1.2", - "release": "@spruce" + "version": "1.1.2" } From df933ae9bc194ba81fbb205624a755b2708489c5 Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Tue, 7 Nov 2023 16:48:10 -0500 Subject: [PATCH 3/5] use the version.json file, update through the spruce workflows to apply the appropriate release --- src/utils/user-agent.ts | 12 +++--------- src/version.json | 3 ++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/utils/user-agent.ts b/src/utils/user-agent.ts index 8d06c05d..ab1f4a30 100644 --- a/src/utils/user-agent.ts +++ b/src/utils/user-agent.ts @@ -10,15 +10,9 @@ export const buildUserAgent = (isLegacy: boolean) => { 'lang=typescript', ]; - // If there is a PINECONE_RELEASE_VERSION environment variable - // set append to the user agent - if ( - typeof process !== 'undefined' && - process && - process.env && - process.env.PINECONE_RELEASE_VERSION - ) { - userAgentParts.push(`release=${process.env.PINECONE_RELEASE_VERSION}`); + // If there's a release in packageInfo, append to the user agent + if (packageInfo.release && packageInfo.release !== '') { + userAgentParts.push(`release=${packageInfo.release}`); } if (isEdge()) { diff --git a/src/version.json b/src/version.json index adc962b9..f1bba8e8 100644 --- a/src/version.json +++ b/src/version.json @@ -1,4 +1,5 @@ { "name": "@pinecone-database/pinecone", - "version": "1.1.2" + "version": "1.1.2", + "release": "" } From f9252b48db47b27a0aa0808f8370dddacde1579c Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Tue, 7 Nov 2023 16:49:17 -0500 Subject: [PATCH 4/5] update workflow files --- .github/workflows/release-spruce-dev.yml | 3 ++- .github/workflows/release-spruce.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-spruce-dev.yml b/.github/workflows/release-spruce-dev.yml index c0482bcc..06135fe7 100644 --- a/.github/workflows/release-spruce-dev.yml +++ b/.github/workflows/release-spruce-dev.yml @@ -34,10 +34,11 @@ jobs: currentVersion=$(jq -r '.version' package.json) timestamp=$(date +%Y%m%d%H%M%S) devVersion="$currentVersion-spruceDev.$timestamp" + release="@spruceDev" jq --arg newVersion "$devVersion" '.version = $newVersion' package.json > package.tmp && mv package.tmp package.json jq --arg newVersion "$devVersion" '.version = $newVersion' package-lock.json > package-lock.tmp && mv package-lock.tmp package-lock.json jq --arg newVersion "$devVersion" '.packages[""].version = $newVersion' package-lock.json > package-lock.tmp && mv package-lock.tmp package-lock.json - jq --null-input --arg version "$devVersion" '{"name": "@pinecone-database/pinecone", "version": $version}' > src/version.json + jq --null-input --arg version "$devVersion" --arg release "$release" '{"name": "@pinecone-database/pinecone", "version": $version, "release": $release}' > src/version.json - name: 'Publish to npm' run: npm publish --tag spruceDev diff --git a/.github/workflows/release-spruce.yml b/.github/workflows/release-spruce.yml index 52c38f54..8f458b5a 100644 --- a/.github/workflows/release-spruce.yml +++ b/.github/workflows/release-spruce.yml @@ -22,10 +22,11 @@ jobs: currentVersion=$(jq -r '.version' package.json) timestamp=$(date +%Y%m%d%H%M%S) devVersion="$currentVersion-spruce.$timestamp" + release="@spruce" jq --arg newVersion "$devVersion" '.version = $newVersion' package.json > package.tmp && mv package.tmp package.json jq --arg newVersion "$devVersion" '.version = $newVersion' package-lock.json > package-lock.tmp && mv package-lock.tmp package-lock.json jq --arg newVersion "$devVersion" '.packages[""].version = $newVersion' package-lock.json > package-lock.tmp && mv package-lock.tmp package-lock.json - jq --null-input --arg version "$devVersion" '{"name": "@pinecone-database/pinecone", "version": $version}' > src/version.json + jq --null-input --arg version "$devVersion" --arg release "$release" '{"name": "@pinecone-database/pinecone", "version": $version, "release": $release}' > src/version.json - name: 'Publish to npm' run: npm publish --tag spruce From 5b9da968f6b06b84fad3cbe7a241db5a07e44231 Mon Sep 17 00:00:00 2001 From: Austin DeNoble Date: Tue, 7 Nov 2023 16:58:57 -0500 Subject: [PATCH 5/5] cleanup github workflow files further --- .github/workflows/release-spruce-dev.yml | 3 +-- .github/workflows/release-spruce.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-spruce-dev.yml b/.github/workflows/release-spruce-dev.yml index 06135fe7..3dda59f3 100644 --- a/.github/workflows/release-spruce-dev.yml +++ b/.github/workflows/release-spruce-dev.yml @@ -34,11 +34,10 @@ jobs: currentVersion=$(jq -r '.version' package.json) timestamp=$(date +%Y%m%d%H%M%S) devVersion="$currentVersion-spruceDev.$timestamp" - release="@spruceDev" jq --arg newVersion "$devVersion" '.version = $newVersion' package.json > package.tmp && mv package.tmp package.json jq --arg newVersion "$devVersion" '.version = $newVersion' package-lock.json > package-lock.tmp && mv package-lock.tmp package-lock.json jq --arg newVersion "$devVersion" '.packages[""].version = $newVersion' package-lock.json > package-lock.tmp && mv package-lock.tmp package-lock.json - jq --null-input --arg version "$devVersion" --arg release "$release" '{"name": "@pinecone-database/pinecone", "version": $version, "release": $release}' > src/version.json + jq --null-input --arg version "$devVersion" --arg release "@spruce" '{"name": "@pinecone-database/pinecone", "version": $version, "release": $release}' > src/version.json - name: 'Publish to npm' run: npm publish --tag spruceDev diff --git a/.github/workflows/release-spruce.yml b/.github/workflows/release-spruce.yml index 8f458b5a..125cae12 100644 --- a/.github/workflows/release-spruce.yml +++ b/.github/workflows/release-spruce.yml @@ -22,11 +22,10 @@ jobs: currentVersion=$(jq -r '.version' package.json) timestamp=$(date +%Y%m%d%H%M%S) devVersion="$currentVersion-spruce.$timestamp" - release="@spruce" jq --arg newVersion "$devVersion" '.version = $newVersion' package.json > package.tmp && mv package.tmp package.json jq --arg newVersion "$devVersion" '.version = $newVersion' package-lock.json > package-lock.tmp && mv package-lock.tmp package-lock.json jq --arg newVersion "$devVersion" '.packages[""].version = $newVersion' package-lock.json > package-lock.tmp && mv package-lock.tmp package-lock.json - jq --null-input --arg version "$devVersion" --arg release "$release" '{"name": "@pinecone-database/pinecone", "version": $version, "release": $release}' > src/version.json + jq --null-input --arg version "$devVersion" --arg release "@spruce" '{"name": "@pinecone-database/pinecone", "version": $version, "release": $release}' > src/version.json - name: 'Publish to npm' run: npm publish --tag spruce