Skip to content
Open
Show file tree
Hide file tree
Changes from 9 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
187 changes: 0 additions & 187 deletions .circleci/config.yml

This file was deleted.

186 changes: 186 additions & 0 deletions .github/MIGRATION_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# CircleCI to GitHub Actions Migration Summary
Copy link
Contributor Author

@dreamwasp dreamwasp Oct 23, 2025

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


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.
1 change: 1 addition & 0 deletions .github/actions/yarn/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ runs:
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610
with:
node-version-file: .nvmrc
cache: 'yarn'

- name: Install dependencies
shell: bash
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

changed the required checks to the following, so shouldn't need this anymore

Copy link
Contributor Author

@dreamwasp dreamwasp Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

& pr-title

- name: automerge
uses: pascalgn/[email protected]
env:
Expand Down
Loading
Loading