chore: improve release and pre-release CI

This commit is contained in:
Ralph Khreish
2025-08-03 00:30:13 +03:00
parent e495b2b559
commit dcf49fc590
2 changed files with 23 additions and 15 deletions

View File

@@ -2,12 +2,20 @@ name: Pre-Release (RC)
on: on:
workflow_dispatch: # Allows manual triggering from GitHub UI/API workflow_dispatch: # Allows manual triggering from GitHub UI/API
inputs:
branch:
description: 'Branch to create pre-release from (e.g., next, develop)'
required: false
default: 'next'
type: string
concurrency: pre-release-${{ github.ref }} concurrency: pre-release-${{ github.ref }}
jobs: jobs:
rc: rc:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# Only allow pre-releases on non-main branches
if: github.ref != 'refs/heads/main'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:

View File

@@ -38,26 +38,26 @@ jobs:
run: npm ci run: npm ci
timeout-minutes: 2 timeout-minutes: 2
- name: Exit pre-release mode and clean up - name: Check pre-release mode
run: | run: |
echo "🔄 Ensuring we're not in pre-release mode for main branch..." echo "🔍 Checking pre-release mode status..."
# Exit pre-release mode if we're in it
npx changeset pre exit || echo "Not in pre-release mode"
# Remove pre.json file if it exists (belt and suspenders approach)
if [ -f .changeset/pre.json ]; then if [ -f .changeset/pre.json ]; then
echo "🧹 Removing pre.json file..." echo "❌ ERROR: Main branch is in pre-release mode!"
rm -f .changeset/pre.json echo ""
fi echo "Pre-release mode should only be used on feature branches, not main."
echo ""
# Verify the file is gone echo "To fix this, run the following commands locally:"
if [ ! -f .changeset/pre.json ]; then echo " npx changeset pre exit"
echo "✅ pre.json successfully removed" echo " git add .changeset/pre.json"
else echo " git commit -m 'chore: exit pre-release mode'"
echo "❌ Failed to remove pre.json" echo " git push origin main"
echo ""
echo "Then re-run this workflow."
exit 1 exit 1
fi fi
echo "✅ Not in pre-release mode - proceeding with release"
- name: Create Release Pull Request or Publish to npm - name: Create Release Pull Request or Publish to npm
uses: changesets/action@v1 uses: changesets/action@v1