feat: resolve component dependencies and update storybook (#807) #47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Pipeline | |
| on: | |
| push: | |
| branches: | |
| - alpha | |
| - beta | |
| - rc | |
| - main | |
| paths-ignore: | |
| - "*.md" | |
| - "docs/**" | |
| - ".github/ISSUE_TEMPLATE/**" | |
| - ".github/pull_request_template.md" | |
| - "CHANGELOG.md" | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: "Release type for manual trigger" | |
| required: true | |
| default: "stable" | |
| type: choice | |
| options: | |
| - rc | |
| - stable | |
| confirm_release: | |
| description: "Type 'CONFIRM' to proceed with release" | |
| required: true | |
| type: string | |
| # Serialize releases per branch — only one release can run at a time per branch. | |
| # For alpha/beta prereleases, cancel any in-progress run if a newer commit arrives. | |
| # For rc/main stable releases, never cancel (let them complete). | |
| concurrency: | |
| group: release-${{ github.ref_name }} | |
| cancel-in-progress: ${{ contains(fromJson('["alpha","beta"]'), github.ref_name) }} | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| packages: write | |
| jobs: | |
| # ── Pre-release: auto-triggered on alpha/beta pushes ────────────────────── | |
| prerelease: | |
| name: Prerelease (${{ github.ref_name }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| if: contains(fromJson('["alpha", "beta"]'), github.ref_name) && !contains(github.event.head_commit.message, '[skip ci]') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.18.1 | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| cache: "pnpm" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Setup Git identity and sync branch | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git fetch origin ${{ github.ref_name }} | |
| git checkout -B ${{ github.ref_name }} origin/${{ github.ref_name }} | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run validation | |
| run: pnpm run validate | |
| - name: Check bundle size | |
| run: pnpm run size | |
| - name: Build packages | |
| run: pnpm run build:production | |
| - name: Semantic Release (Prerelease) | |
| id: semantic | |
| run: | | |
| set +e | |
| SR_OUTPUT=$(pnpm run release:semantic 2>&1) | |
| SR_EXIT=$? | |
| echo "$SR_OUTPUT" | |
| # If semantic-release failed because the version was already published | |
| # (npm E403 / "cannot publish over previously published") it means a | |
| # prior run already succeeded. Treat as a no-op to keep the pipeline green. | |
| if [[ $SR_EXIT -ne 0 ]]; then | |
| if echo "$SR_OUTPUT" | grep -q -i \ | |
| -e "cannot publish over.*previously published" \ | |
| -e "previously published versions" \ | |
| -e "code E403" \ | |
| -e "code EOTP"; then | |
| echo "Version already published or OTP required — treating as no-op." | |
| exit 0 | |
| fi | |
| exit $SR_EXIT | |
| fi | |
| if echo "$SR_OUTPUT" | grep -i -q -E "Published release|Created tag|Published version"; then | |
| echo "new_release_published=true" >> $GITHUB_OUTPUT | |
| fi | |
| # Update npm latest tag so npx @ruma-kit/cli installs the newest version | |
| CLI_VER=$(node -p "require('./packages/cli/package.json').version") | |
| if [ "$CLI_VER" != "0.0.0" ]; then | |
| echo "Promoting @ruma-kit packages version $CLI_VER to npm latest tag..." | |
| npm dist-tag add @ruma-kit/cli@$CLI_VER latest || true | |
| npm dist-tag add @ruma-kit/ui@$CLI_VER latest || true | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Upload prerelease artifacts | |
| if: steps.semantic.outputs.new_release_published == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: prerelease-artifacts-${{ github.ref_name }}-${{ github.run_id }} | |
| path: | | |
| dist/ | |
| ui/dist/ | |
| retention-days: 30 | |
| # ── Stable release: manual dispatch or push to rc/main ─────────────────── | |
| stable-release: | |
| name: Stable Release | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| if: > | |
| (github.event_name == 'workflow_dispatch') || | |
| (contains(fromJson('["rc","main"]'), github.ref_name) && | |
| !contains(github.event.head_commit.message, '[skip ci]')) | |
| outputs: | |
| published: ${{ steps.changesets.outputs.published }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.18.1 | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| cache: "pnpm" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run validation | |
| run: pnpm run validate | |
| - name: Check bundle size | |
| run: pnpm run size | |
| - name: Validate manual release confirmation | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| if [ "${{ github.event.inputs.confirm_release }}" != "CONFIRM" ]; then | |
| echo "Release not confirmed. Please type 'CONFIRM' to proceed." | |
| exit 1 | |
| fi | |
| echo "Release confirmed for ${{ github.event.inputs.release_type }} on branch ${{ github.ref_name }}" | |
| - name: Setup Git identity and sync branch | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git fetch origin ${{ github.ref_name }} | |
| git checkout -B ${{ github.ref_name }} origin/${{ github.ref_name }} | |
| - name: Build packages | |
| run: pnpm run build:production | |
| - name: Create Release Pull Request or Publish (Stable) | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| publish: pnpm changeset:publish | |
| version: pnpm changeset:version | |
| commit: "chore: release stable version" | |
| title: "chore: release stable version" | |
| createGithubReleases: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Upload stable artifacts | |
| if: steps.changesets.outputs.published == 'true' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: stable-artifacts-${{ github.ref_name }}-${{ github.run_id }} | |
| path: | | |
| dist/ | |
| ui/dist/ | |
| retention-days: 90 | |
| # ── Sync main → dev after every stable release ─────────────────────────── | |
| sync-dev: | |
| name: Sync main -> dev | |
| needs: stable-release | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| if: needs.stable-release.result == 'success' && needs.stable-release.outputs.published == 'true' && github.ref_name == 'main' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Git identity | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| - name: Sync main → dev | |
| run: | | |
| git fetch origin | |
| git checkout dev | |
| git pull origin dev | |
| git merge origin/main --no-ff -m "chore: sync main → dev after stable release [skip ci]" || true | |
| git push origin dev |