Implement new components and enhance CI/CD workflows for Ruma UI (#783) #35
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: | |
| - ".changeset/**" | |
| - "CHANGELOG.md" | |
| - "package.json" | |
| 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 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| # Allow concurrent prereleases but serialize stable ones | |
| 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 | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| - 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 | |
| # (E400) it means a previous concurrent or re-triggered run already | |
| # succeeded. Treat this as a no-op success to keep the pipeline green. | |
| if [[ $SR_EXIT -ne 0 ]]; then | |
| if echo "$SR_OUTPUT" | grep -q "Cannot publish over previously published version"; then | |
| echo "⚠️ Version already published to npm — previous run succeeded. 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 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish CLI package (Prerelease) | |
| if: steps.semantic.outputs.new_release_published == 'true' | |
| run: cd packages/cli && pnpm publish --no-git-checks --access public | |
| env: | |
| 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 | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| - 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 }} | |
| - name: Publish CLI package (Stable) | |
| if: steps.changesets.outputs.published == 'true' | |
| run: cd packages/cli && pnpm publish --no-git-checks --access public | |
| env: | |
| 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 |