Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/pr-205.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wdio/browserstack-service": patch
---

- None — internal release tooling only.
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ jobs:
# Merge the "Version Packages" PR first: this publishes only when there are no pending
# changesets. If any remain, the action safely opens/updates the Version PR instead.
- name: Publish to npm
id: publish
if: github.event_name == 'workflow_dispatch' && inputs.publish
uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1
with:
Expand All @@ -107,6 +108,56 @@ jobs:
# No NPM_TOKEN: auth is OIDC via id-token: write above.
NPM_CONFIG_PROVENANCE: 'true'

# railsApp derives a version's tier from the sdk_version_releases catalog; without this
# callback the catalog only advances when someone re-runs the registry backfill.
# Gated on steps.publish.outputs.published because the action opens the Version PR and
# publishes nothing when changesets are still pending. Serves both release lines — this
# workflow runs on main (v9) and on v8 — so no branch special-casing.
- name: Record release in the SDK version catalog
if: >-
github.event_name == 'workflow_dispatch' && inputs.publish
&& steps.publish.outputs.published == 'true'
continue-on-error: true
env:
SDK_RELEASE_SERVICE_CREDS: ${{ secrets.SDK_RELEASE_SERVICE_CREDS }}
PUBLISHED_PACKAGES: ${{ steps.publish.outputs.publishedPackages }}
run: |
set -uo pipefail

if [ -z "${SDK_RELEASE_SERVICE_CREDS:-}" ]; then
echo "::warning::sdk-release-service credential not configured; skipping catalog write"
exit 0
fi

VERSION="$(printf '%s' "$PUBLISHED_PACKAGES" \
| jq -r '.[] | select(.name == "@wdio/browserstack-service") | .version' \
| head -n1)"

if ! printf '%s' "$VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+[0-9A-Za-z.+-]*$'; then
echo "::warning::'$VERSION' is not a release version; skipping catalog write"
exit 0
fi

printf '{"language":"ecmascript","version":"%s","release_date":"%s"}' \
"$VERSION" "$(date -u +%F)" > /tmp/sdkrel_payload.json

HTTP_CODE=$(curl -s -o /tmp/sdkrel_body.json -w '%{http_code}' \
--max-time 20 --retry 2 --retry-delay 3 \
-X POST "https://api.browserstack.com/sdk/v1/admin/releases" \
-u "$SDK_RELEASE_SERVICE_CREDS" \
-H 'Content-Type: application/json' \
-d @/tmp/sdkrel_payload.json)

echo "SDK release catalog responded $HTTP_CODE for ecmascript $VERSION"
cat /tmp/sdkrel_body.json 2>/dev/null || true
rm -f /tmp/sdkrel_payload.json /tmp/sdkrel_body.json

case "$HTTP_CODE" in
200|201) ;;
409) echo "::warning::ecmascript $VERSION is already recorded with a DIFFERENT release_date. Investigate; do not force." ;;
*) echo "::warning::could not record ecmascript $VERSION (HTTP $HTTP_CODE). The publish succeeded; the catalog stays stale for this version until the next backfill." ;;
esac

# Canary (manual, workflow_dispatch with canary=true): snapshot-version the pending
# changesets and publish a prerelease to the `canary` dist-tag via the SAME OIDC trusted
# publisher. Validates OIDC + provenance end-to-end without touching `latest`.
Expand Down