-
Couldn't load subscription status.
- Fork 32
ci: convert production workflows #3192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 9 commits
48f9ae1
9ea1ea7
54c6644
4ff1579
9a97cd9
44efeec
da23bb2
81ec370
e8d3517
4aed134
72f1244
0594990
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,186 @@ | ||
| # CircleCI to GitHub Actions Migration Summary | ||
|
|
||
| This document summarizes the migration from CircleCI to GitHub Actions completed on October 21, 2025. | ||
|
|
||
| ## New GitHub Actions Workflows Created | ||
|
|
||
| ### 1. `publish-production.yml` | ||
|
|
||
| - **Purpose**: Publishes production packages to npm when changes are merged to main | ||
| - **Trigger**: Push to main branch | ||
| - **Key Features**: | ||
| - Skips automated release commits to prevent circular builds | ||
| - Uses Lerna for conventional commit-based versioning | ||
| - Creates GitHub releases automatically | ||
| - Uses concurrency control to prevent simultaneous publish jobs | ||
|
|
||
| ### 2. `deploy-production.yml` | ||
|
|
||
| - **Purpose**: Deploys production Storybook to GitHub Pages when changes are merged to main | ||
| - **Trigger**: Push to main branch | ||
| - **Key Features**: | ||
| - Builds all packages and Storybook | ||
| - Deploys to GitHub Pages using gh-pages | ||
| - Uses concurrency control to prevent simultaneous deploy jobs | ||
| - Skips automated release commits | ||
|
|
||
| ## Files Modified | ||
|
|
||
| ### 1. `.github/workflows/automerge.yml` | ||
|
|
||
| - **Changes**: | ||
| - Updated CircleCI check reference from `build-test` to `test` | ||
| - Removed redundant `wait-for-check` step | ||
| - **Reason**: The `pascalgn/automerge-action` automatically waits for all required status checks configured in branch protection rules, making the explicit wait step unnecessary | ||
|
|
||
| ### 2. `.github/actions/yarn/action.yml` | ||
|
|
||
| - **Change**: Added `cache: 'yarn'` to `setup-node` action | ||
| - **Reason**: Enables automatic caching of Yarn dependencies using GitHub Actions' built-in caching | ||
|
|
||
| ### 3. `README.md` | ||
|
|
||
| - **Changes**: | ||
| - Replaced CircleCI badge with GitHub Actions badge | ||
| - Updated publishing documentation to reference GitHub Actions instead of CircleCI | ||
|
|
||
| ### 4. `nx.json` | ||
|
|
||
| - **Change**: Updated `ci` named input to reference GitHub Actions workflows | ||
| - **Before**: Referenced `.circleci/config.yml` and `.github/push.yml` (both incorrect/non-existent) | ||
| - **After**: References `.github/workflows/**/*.yml` and `.github/actions/**/*.yml` | ||
| - **Impact**: Nx will now properly invalidate caches when any GitHub Actions workflow or action changes | ||
| - **Documentation**: [Nx Named Inputs](https://nx.dev/concepts/more-concepts/customizing-inputs#named-inputs) | ||
|
|
||
| ## Files Deleted | ||
|
|
||
| ### 1. `.circleci/` directory | ||
|
|
||
| - **Removed**: Entire CircleCI configuration directory | ||
| - **Reason**: All workflows have been successfully migrated to GitHub Actions | ||
|
|
||
| ## Workflow Comparison | ||
|
|
||
| | CircleCI Job | GitHub Actions Workflow | Status | | ||
| | --------------- | ------------------------------------ | ----------- | | ||
| | `checkout_code` | Integrated into individual workflows | ✅ Migrated | | ||
| | `publish` | `publish-production.yml` | ✅ Migrated | | ||
| | `deploy` | `deploy-production.yml` | ✅ Migrated | | ||
|
|
||
| ## Key Design Decisions | ||
|
|
||
| ### 1. **DRY Principles** | ||
|
|
||
| All workflows reuse the existing composite actions in `.github/actions/`: | ||
|
|
||
| - `yarn/` - Node.js setup and dependency installation | ||
| - `set-git-user/` - Git user configuration | ||
| - `set-npm-token/` - NPM authentication | ||
| - `skip-automated-commits/` - Skip release commits | ||
| - `validate-pr-context/` - Ensure PR context exists | ||
|
|
||
| ### 2. **Concurrency Control** | ||
|
|
||
| Replaced CircleCI's queue orb with GitHub Actions concurrency groups: | ||
|
|
||
| - `publish-production` - Ensures only one publish runs at a time | ||
| - `deploy-production` - Ensures only one deploy runs at a time | ||
| - Both set `cancel-in-progress: false` to avoid canceling active deployments | ||
|
|
||
| ### 3. **Consistent Patterns** | ||
|
|
||
| Followed patterns established in existing workflows: | ||
|
|
||
| - Same Node.js version (`22.13.1`) | ||
| - Same runner (`ubuntu-22.04`) | ||
| - Same environment variables | ||
| - Same timeout settings (30 minutes) | ||
| - Same permissions structure | ||
|
|
||
| ### 4. **Caching Strategy** | ||
|
|
||
| All workflows include comprehensive caching to speed up builds, matching CircleCI's strategy: | ||
|
|
||
| **Yarn dependencies** (via `yarn` action): | ||
|
|
||
| - Cached automatically by `setup-node` action using `cache: 'yarn'` | ||
| - Cache key based on `yarn.lock` hash | ||
| - Equivalent to CircleCI's yarn cache | ||
|
|
||
| **Nx build cache** (in production workflows): | ||
|
|
||
| - Path: `node_modules/.cache/nx` | ||
| - Primary key: `nx-{OS}-{yarn.lock}-{branch}-{run_id}` (similar to CircleCI's epoch-based key) | ||
| - Restore keys fall back progressively: branch → yarn.lock → OS | ||
| - Uses standard `actions/cache@v4` which automatically saves on success | ||
|
|
||
| **Webpack cache** (in deploy workflow): | ||
|
|
||
| - Paths: `node_modules/.cache` and `packages/styleguide/node_modules/.cache` | ||
| - Primary key: `webpack-{OS}-{yarn.lock}-{branch}-{commit_sha}` (matches CircleCI's revision-based key) | ||
| - Restore keys fall back to branch and yarn.lock levels | ||
| - Only included in deploy workflow since it's specifically needed for Storybook builds | ||
|
|
||
| **Key improvements over CircleCI:** | ||
|
|
||
| - Uses GitHub Actions' native `actions/cache@v4` (simpler than separate restore/save) | ||
| - Automatic cache saving (no need for `if: always()` conditions) | ||
| - `github.run_id` for Nx provides unique per-run keys similar to CircleCI's `{{ epoch }}` | ||
| - `github.sha` for webpack matches CircleCI's `{{ .Revision }}` | ||
|
|
||
| ### 5. **Security Best Practices** | ||
|
|
||
| - Minimal permissions using principle of least privilege | ||
| - Separate tokens for different purposes (`ACTIONS_GITHUB_TOKEN` vs `NODE_AUTH_TOKEN`) | ||
| - Explicit permission declarations for each workflow | ||
|
|
||
| ## Testing Checklist | ||
|
|
||
| Before considering this migration complete, verify: | ||
|
|
||
| - [ ] Verify required secrets are configured (`ACTIONS_GITHUB_TOKEN`, `NODE_AUTH_TOKEN`) | ||
| - [ ] Confirm branch protection rules require: `test`, `format`, `lint (lint)`, `lint (verify)` | ||
| - [ ] Merge a PR to main and confirm packages are published correctly | ||
| - [ ] Verify GitHub releases are created with proper changelog | ||
| - [ ] Confirm Storybook deploys to GitHub Pages successfully | ||
| - [ ] Check that automerge waits for all required checks before merging | ||
| - [ ] Verify concurrency controls prevent overlapping publishes/deploys | ||
| - [ ] Ensure skip-automated-commits properly prevents circular builds | ||
| - [ ] Confirm Yarn/Nx/webpack caches are working (check workflow run times) | ||
|
|
||
| ## Secrets Required | ||
|
|
||
| Ensure the following secrets are configured in GitHub: | ||
|
|
||
| - `ACTIONS_GITHUB_TOKEN` - For creating releases and pushing to gh-pages | ||
| - `NODE_AUTH_TOKEN` - For publishing to npm | ||
| - Other existing secrets used by other workflows | ||
|
|
||
| ## Summary of All Changes | ||
|
|
||
| **New files (3):** | ||
|
|
||
| - `.github/workflows/publish-production.yml` - Publishes production packages to npm | ||
| - `.github/workflows/deploy-production.yml` - Deploys production Storybook to GitHub Pages | ||
| - `.github/MIGRATION_SUMMARY.md` - This documentation file | ||
|
|
||
| **Modified files (4):** | ||
|
|
||
| - `.github/workflows/automerge.yml` - Updated check name and removed redundant wait step | ||
| - `.github/actions/yarn/action.yml` - Added Yarn caching via setup-node | ||
| - `README.md` - Updated badge and documentation | ||
| - `nx.json` - Updated CI input references to GitHub Actions | ||
|
|
||
| **Deleted:** | ||
|
|
||
| - `.circleci/` directory - Entire CircleCI configuration removed | ||
|
|
||
| ## Rollback Plan | ||
|
|
||
| If issues arise, you can temporarily: | ||
|
|
||
| 1. Restore `.circleci/config.yml` from git history | ||
| 2. Re-enable CircleCI in the repository settings | ||
| 3. Disable the new production workflows | ||
|
|
||
| However, this should only be done as a last resort. Most issues can be fixed by updating the new workflows. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,15 +20,6 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| if: github.ref != 'refs/heads/main' | ||
| steps: | ||
| - name: Wait for CI build | ||
| uses: fountainhead/[email protected] | ||
| id: wait-for-build | ||
| with: | ||
| token: ${{ secrets.ACTIONS_GITHUB_TOKEN }} | ||
| checkName: build-test | ||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
| timeoutSeconds: 1200 | ||
| intervalSeconds: 30 | ||
|
Comment on lines
-23
to
-31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. & pr-title |
||
| - name: automerge | ||
| uses: pascalgn/[email protected] | ||
| env: | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove before shiupping, but wanted to keep cursors notes for the review