From 8c34e45c15444b51dcf00f62cf2e003b3d9ed9e4 Mon Sep 17 00:00:00 2001 From: maddygoround Date: Thu, 19 Jun 2025 19:47:22 +0530 Subject: [PATCH 1/3] chore: specify wrangler version 2.0.0 in deployment workflow for both publish steps --- .github/workflows/deploy-renderer.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-renderer.yml b/.github/workflows/deploy-renderer.yml index 142a46e1..e6d88153 100644 --- a/.github/workflows/deploy-renderer.yml +++ b/.github/workflows/deploy-renderer.yml @@ -29,10 +29,11 @@ jobs: id: package-version uses: martinbeentjes/npm-get-version-action@main - - uses: cloudflare/wrangler-action@2.0.0 + - uses: cloudflare/wrangler-action@v3 name: Publish Release if: startsWith(github.ref, 'refs/tags/v') with: + wranglerVersion: "2.0.0" apiToken: ${{ secrets.CF_API_TOKEN }} accountId: ${{ secrets.CF_ACCOUNT_ID }} workingDirectory: './build/hosted-renderer' @@ -42,10 +43,11 @@ jobs: node directory-to-kv.js --prefix version/${{ steps.package-version.outputs.current-version }} --source ../../renderer/dist --destination renderer.json wrangler kv:bulk put renderer.json --binding=SCENELESS_KV - - uses: cloudflare/wrangler-action@2.0.0 + - uses: cloudflare/wrangler-action@v3 name: Publish latest if: ${{github.ref == 'refs/heads/main' }} with: + wranglerVersion: "2.0.0" apiToken: ${{ secrets.CF_API_TOKEN }} accountId: ${{ secrets.CF_ACCOUNT_ID }} workingDirectory: './build/hosted-renderer' From fecfdb216f911f09a8385949dff76871f8472ece Mon Sep 17 00:00:00 2001 From: maddygoround Date: Thu, 19 Jun 2025 20:17:58 +0530 Subject: [PATCH 2/3] chore: enhance publish workflow to check for existing npm package versions before publishing --- .github/workflows/publish.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e43cccf4..9261c8fc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,6 +8,8 @@ on: push: branches: - main + pull_request: + types: [opened, synchronize, reopened] name: Tag and release package jobs: @@ -27,8 +29,29 @@ jobs: id: package-version uses: martinbeentjes/npm-get-version-action@main + - name: Check if version already exists on npm + id: check_version_exists + run: | + PACKAGE_NAME="@api.stream/studio-kit" + PACKAGE_VERSION="${{ steps.package-version.outputs.current-version }}" + + echo "Checking if version $PACKAGE_VERSION of $PACKAGE_NAME already exists on npm..." + + # Fetch all published versions as a JSON array + NPM_VERSIONS_JSON=$(npm view "$PACKAGE_NAME" versions --json || echo "[]") + + # Check if the current version exists in the JSON array using jq + if echo "$NPM_VERSIONS_JSON" | jq -e ".[] == \"$PACKAGE_VERSION\"" > /dev/null; then + echo "✅ Version $PACKAGE_VERSION already exists on npm. Skipping publish." + echo "version_exists=true" >> "$GITHUB_OUTPUT" + else + echo "🚀 Version $PACKAGE_VERSION does not exist on npm. Proceeding with publish." + echo "version_exists=false" >> "$GITHUB_OUTPUT" + fi + - name: Tag commit with release version id: tag_version + if: steps.check_version_exists.outputs.version_exists != 'true' uses: mathieudutour/github-tag-action@v6.0 with: # Due to a quirk of GitHub actions, we must use an access token of a real user to create @@ -38,6 +61,7 @@ jobs: custom_tag: ${{ steps.package-version.outputs.current-version}} - name: Create a GitHub release + if: steps.check_version_exists.outputs.version_exists != 'true' uses: ncipollo/release-action@v1 with: tag: ${{ steps.tag_version.outputs.new_tag }} @@ -45,6 +69,7 @@ jobs: body: ${{ steps.tag_version.outputs.changelog }} - name: Publish package to NPM + if: steps.check_version_exists.outputs.version_exists != 'true' uses: JS-DevTools/npm-publish@v1 with: token: ${{ secrets.NPM_TOKEN }} From 205169c577fd8e2cf986c58933eafed3f3d78507 Mon Sep 17 00:00:00 2001 From: maddygoround Date: Thu, 19 Jun 2025 21:55:09 +0530 Subject: [PATCH 3/3] chore: remove pull request trigger from publish workflow --- .github/workflows/publish.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9261c8fc..b99377e1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,9 +8,6 @@ on: push: branches: - main - pull_request: - types: [opened, synchronize, reopened] - name: Tag and release package jobs: publish: