Skip to content

chore: remove cef short alias package and update version to 3.3.1 #56

chore: remove cef short alias package and update version to 3.3.1

chore: remove cef short alias package and update version to 3.3.1 #56

Workflow file for this run

name: Release
on:
push:
branches:
- main
- next
- "v*"
paths:
- 'packages/**'
- '.changeset/**'
- 'package.json'
- 'pnpm-lock.yaml'
- '.github/workflows/pipeline.yml'
pull_request:
branches:
- main
- next
- "v*"
paths:
- 'packages/**'
- '.changeset/**'
- 'package.json'
- 'pnpm-lock.yaml'
- '.github/workflows/pipeline.yml'
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: write
pull-requests: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
scope: '@repo'
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm run build
- name: Type check
run: pnpm run check-types
- name: Lint
run: pnpm run lint
- name: Test
run: pnpm run test
- name: Version and Publish
run: |
# Detect branch name correctly for both Push and PR
if [ "${{ github.event_name }}" = "pull_request" ]; then
BRANCH=${{ github.head_ref }}
else
BRANCH=${GITHUB_REF#refs/heads/}
fi
echo "🌿 Current branch: $BRANCH"
# 🛑 SKIP VERSIONING/PUBLISHING ON PULL REQUESTS OR DEV BRANCH
if [ "${{ github.event_name }}" = "pull_request" ] || [ "$BRANCH" = "dev" ]; then
echo "🔍 Pull Request or DEV branch detected. Skipping versioning and publishing logic."
exit 0
fi
# Setup git
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Determine Primary and Secondary NPM tags based on branch
TAG="latest"
EXTRA_TAG=""
if [ "$BRANCH" = "next" ]; then
TAG="next"
EXTRA_TAG="beta"
elif [[ $BRANCH == v* ]]; then
TAG="legacy"
elif [ "$BRANCH" = "main" ]; then
TAG="latest"
EXTRA_TAG="stable"
fi
echo "🏷️ Primary Tag: $TAG"
[ -n "$EXTRA_TAG" ] && echo "🏷️ Extra Tag: $EXTRA_TAG"
# If there are changesets, version them and commit
if [ "$(ls .changeset/*.md 2>/dev/null | grep -v 'README.md')" ]; then
echo "🚀 Changesets found. Versioning..."
# Version packages
pnpm changeset version
# Commit and push back to current branch
git add .
git commit -m "chore(release): version packages [skip ci]"
git push origin $BRANCH
fi
# Publish to NPM
echo "📦 Publishing to NPM with tag: $TAG"
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > .npmrc
# We use a subshell to catch if publish is skipped or fails
if pnpm changeset publish --tag $TAG; then
echo "✅ Publish successful"
else
echo "⚠️ Publish skipped or failed. Force-updating tags for safety..."
fi
# 🚀 CRITICAL FIX: Always ensure the primary tag points to the current version
# This handles the case where v2.0.0 was already published to 'next' and now we need it on 'latest'
pnpm -r exec sh -c 'if [ "$(node -p "require(\"./package.json\").private")" != "true" ]; then npm dist-tag add $(node -p "require(\"./package.json\").name")@$(node -p "require(\"./package.json\").version") '$TAG'; fi' || echo "⚠️ Could not update primary tag"
# Add extra tags if defined
if [ -n "$EXTRA_TAG" ]; then
echo "🏷️ Adding extra tag: $EXTRA_TAG"
# Loop through all packages and add the extra tag to the newly published version (skipping private packages)
pnpm -r exec sh -c 'if [ "$(node -p "require(\"./package.json\").private")" != "true" ]; then npm dist-tag add $(node -p "require(\"./package.json\").name")@$(node -p "require(\"./package.json\").version") '$EXTRA_TAG'; fi' || echo "⚠️ Could not add extra tag"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}