Skip to content
Merged
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
29 changes: 29 additions & 0 deletions .github/workflows/docker-stg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ on:
default: 'main'
type: string

# Prevent concurrent staging deployments and avoid conflicts with release workflow
concurrency:
group: staging-deployment-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

Expand Down Expand Up @@ -74,7 +79,20 @@ jobs:
env:
NODE_OPTIONS: '--max-old-space-size=8192'

- name: Check for pending changesets
id: changeset-check
run: |
# Check if there are any pending changesets to create snapshots from
if [ -z "$(find .changeset -name '*.md' -not -name 'README.md' -not -name 'config.json')" ]; then
echo "has_changesets=false" >> $GITHUB_OUTPUT
echo "⚠️ No pending changesets found. Skipping RC publishing to prevent stable version pollution."
else
echo "has_changesets=true" >> $GITHUB_OUTPUT
echo "✅ Pending changesets found. Proceeding with RC snapshot creation."
fi

- name: Create RC snapshot version
if: steps.changeset-check.outputs.has_changesets == 'true'
run: |
# Create RC snapshot version with 'rc' tag
pnpm changeset version --snapshot rc
Expand All @@ -84,14 +102,17 @@ jobs:
HUSKY: 0

- name: Rebuild packages after version update
if: steps.changeset-check.outputs.has_changesets == 'true'
run: pnpm -r build
env:
NODE_OPTIONS: '--max-old-space-size=8192'

- name: Type check all packages
if: steps.changeset-check.outputs.has_changesets == 'true'
run: pnpm -r typecheck

- name: Publish RC packages
if: steps.changeset-check.outputs.has_changesets == 'true'
run: |
# Publish RC packages with dependencies pre-built
# Temporarily disable prepublishOnly scripts to skip rebuild during publishing
Expand All @@ -105,7 +126,15 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
HUSKY: 0

- name: Skip RC publishing notice
if: steps.changeset-check.outputs.has_changesets == 'false'
run: |
echo "🚫 RC publishing skipped because no pending changesets were found."
echo "This prevents publishing stable versions with 'rc' tags."
echo "Stable versions should only be published by the Release workflow with 'latest' tags."

- name: Update export versions for RC packages
if: steps.changeset-check.outputs.has_changesets == 'true'
run: |
# Sync versions.ts with the newly published RC versions
# This ensures staging exports use correct RC versions (e.g., 0.2.1-rc.123)
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ on:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}
# Prevent concurrent release operations and coordinate with staging workflow
concurrency:
group: release-publishing-${{ github.ref }}
cancel-in-progress: false

permissions:
contents: write
Expand Down
Loading