Skip to content
Merged
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
58 changes: 58 additions & 0 deletions .github/workflows/beta-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "Beta Release"

on:
push:
branches:
- beta
workflow_dispatch:

permissions:
contents: read

jobs:
publish-beta:
runs-on: ubuntu-latest
steps:
- name: "Checkout source code"
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Set up Node.js"
uses: actions/setup-node@v4
with:
node-version: 22.x
registry-url: "https://registry.npmjs.org/"

- name: "Install dependencies"
run: npm ci

- name: "Create build"
run: npm run build

- name: "Get version from package.json and create beta version"
id: get_version
run: |
BASE_VERSION=$(node -p 'require("./package.json").version')
BETA_VERSION="$BASE_VERSION-beta"
echo "version=$BETA_VERSION" >> $GITHUB_OUTPUT
echo "Beta version: $BETA_VERSION"

- name: "Check if beta version already exists on NPM"
run: |
BETA_VERSION=${{ steps.get_version.outputs.version }}
# Check if version exists on npm
if npm view @browserstack/mcp-server@$BETA_VERSION version 2>/dev/null; then
echo "Error: Beta version $BETA_VERSION already exists on NPM!"
exit 1
fi
echo "Beta version $BETA_VERSION is available for release"

- name: "Update package.json with beta version"
run: |
npm version ${{ steps.get_version.outputs.version }} --no-git-tag-version

- name: "Publish beta to NPM"
run: npm publish --tag beta --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}