Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

SDK v0.1.2 - Fix release workflow for Trusted Publishing (#13535)

Damian Legawiec7535cda01dbc
diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml
index 2eebfbedc2..b62493a50b 100644
--- a/.github/workflows/sdk.yml
+++ b/.github/workflows/sdk.yml
@@ -47,6 +47,7 @@ jobs:
permissions:
contents: write
pull-requests: write
+ id-token: write
steps:
- uses: actions/checkout@v4
@@ -59,12 +60,16 @@ jobs:
- run: npm ci
- - name: Create Release PR or Publish
- uses: changesets/action@v1
- with:
- publish: npm run release
- version: npm run version
- cwd: sdk
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
+ - name: Check if version is published
+ id: check
+ run: |
+ PACKAGE_VERSION=$(node -p "require('./package.json').version")
+ if npm view @spree/sdk@$PACKAGE_VERSION version 2>/dev/null; then
+ echo "published=true" >> $GITHUB_OUTPUT
+ else
+ echo "published=false" >> $GITHUB_OUTPUT
+ fi
+
+ - name: Build and Publish
+ if: steps.check.outputs.published == 'false'
+ run: npm run build && npm publish --provenance --access public
diff --git a/sdk/CHANGELOG.md b/sdk/CHANGELOG.md
index 3b1c033db9..f8b6c44766 100644
--- a/sdk/CHANGELOG.md
+++ b/sdk/CHANGELOG.md
@@ -1,5 +1,11 @@
# @spree/sdk
+## 0.1.2
+
+### Patch Changes
+
+- Fix release workflow for npm Trusted Publishing
+
## 0.1.1
### Patch Changes
diff --git a/sdk/package.json b/sdk/package.json
index 925e152bc0..32a2aa3d55 100644
--- a/sdk/package.json
+++ b/sdk/package.json
@@ -1,6 +1,6 @@
{
"name": "@spree/sdk",
- "version": "0.1.1",
+ "version": "0.1.2",
"description": "Official TypeScript SDK for Spree Commerce API",
"type": "module",
"main": "./dist/index.cjs",