diff --git a/.claude/commands/release.md b/.claude/commands/release.md new file mode 100644 index 0000000000..37f0056df1 --- /dev/null +++ b/.claude/commands/release.md @@ -0,0 +1,63 @@ +# Release Workflow + +Creates a new release by triggering the GitHub Actions release-dispatch workflow. + +## Arguments + +- `$ARGUMENTS`: Version type or specific version (e.g., `minor`, `patch`, `major`, or `0.12.0`) + +## Process + +1. **Determine the new version**: + +```bash +# Get current version from controller package +CURRENT_VERSION=$(jq -r '.version' packages/controller/package.json) +echo "Current version: $CURRENT_VERSION" +``` + +Based on the argument: +- `major`: Bump major version (e.g., 0.11.4 -> 1.0.0) +- `minor`: Bump minor version (e.g., 0.11.4 -> 0.12.0) +- `patch`: Bump patch version (e.g., 0.11.4 -> 0.11.5) +- Specific version (e.g., `0.12.0`): Use as-is + +2. **Trigger the release workflow**: + +```bash +# Trigger release-dispatch workflow +gh workflow run release-dispatch.yml \ + --field version= \ + --field tag=latest +``` + +For prerelease versions (containing `-alpha`, `-beta`, `-rc`): + +```bash +gh workflow run release-dispatch.yml \ + --field version= \ + --field tag=prerelease +``` + +3. **Verify workflow started**: + +```bash +# List recent workflow runs +gh run list --workflow=release-dispatch.yml --limit=3 +``` + +4. **Provide next steps**: + +After triggering, inform the user: +- A PR titled "Prepare release: X.Y.Z" will be created from branch `prepare-release` +- A draft GitHub release will be created with tag `vX.Y.Z` +- Once the PR is merged, packages will be published to npm automatically +- The draft release will be finalized with changelog notes + +## Version calculation + +Use semver rules to calculate the new version: +- Strip any prerelease suffix (e.g., `-alpha.1`) before bumping +- For `major`: Set to `.0.0` +- For `minor`: Set to `..0` +- For `patch`: Set to `..` diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index d2fc92e68f..2a8ad4605b 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -14,19 +14,42 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + + - uses: dorny/paths-filter@v3 + id: changes + with: + filters: | + code: + - '**/*.ts' + - '**/*.tsx' + - '**/*.js' + - '**/*.jsx' + - '**/*.json' + - '!**/package.json' + + - name: Skip for version-only changes + if: steps.changes.outputs.code != 'true' + run: echo "Only version changes detected, skipping lint" + - uses: actions/setup-node@v4 + if: steps.changes.outputs.code == 'true' with: node-version: 20.x - uses: actions/cache@v4 + if: steps.changes.outputs.code == 'true' with: path: ~/.pnpm-store key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm- - run: corepack enable pnpm + if: steps.changes.outputs.code == 'true' - uses: pnpm/action-setup@v4 + if: steps.changes.outputs.code == 'true' id: pnpm-install with: run_install: false - run: pnpm install --frozen-lockfile + if: steps.changes.outputs.code == 'true' - run: pnpm lint:check + if: steps.changes.outputs.code == 'true' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed06128258..a9e39333d8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,27 +20,50 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + + - uses: dorny/paths-filter@v3 + id: changes + with: + filters: | + code: + - '**/*.ts' + - '**/*.tsx' + - '**/*.js' + - '**/*.jsx' + - '!**/package.json' + + - name: Skip for version-only changes + if: steps.changes.outputs.code != 'true' + run: echo "Only version changes detected, skipping tests" + - uses: actions/setup-node@v4 + if: steps.changes.outputs.code == 'true' with: node-version: 20.x - uses: actions/cache@v4 + if: steps.changes.outputs.code == 'true' with: path: ~/.pnpm-store key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm- - uses: pnpm/action-setup@v4 + if: steps.changes.outputs.code == 'true' with: run_install: | - args: [--frozen-lockfile] - name: Clean iframe dist directory + if: steps.changes.outputs.code == 'true' run: rm -rf packages/controller/dist - run: pnpm build + if: steps.changes.outputs.code == 'true' - name: Run tests with coverage + if: steps.changes.outputs.code == 'true' run: pnpm test:ci --coverage env: NODE_OPTIONS: --max-old-space-size=16384 - uses: codecov/codecov-action@v3 + if: steps.changes.outputs.code == 'true' with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage/lcov.info @@ -72,10 +95,20 @@ jobs: ui: - '.github/workflows/test.yml' - 'packages/keychain/**' - - '**/package.json' - '**/pnpm-lock.yaml' - - - if: steps.changes.outputs.ui == 'true' + code: + - '**/*.ts' + - '**/*.tsx' + - '**/*.js' + - '**/*.jsx' + - '**/*.css' + - '!**/package.json' + + - name: Skip for version-only changes + if: steps.changes.outputs.code != 'true' + run: echo "Only version changes detected, skipping storybook tests" + + - if: steps.changes.outputs.code == 'true' && steps.changes.outputs.ui == 'true' uses: actions/cache@v4 with: path: | @@ -89,12 +122,16 @@ jobs: ${{ runner.os }}-storybook- - run: pnpm i --frozen-lockfile + if: steps.changes.outputs.code == 'true' - run: pnpm build + if: steps.changes.outputs.code == 'true' - run: pnpm test:storybook:update + if: steps.changes.outputs.code == 'true' id: test-storybook continue-on-error: true - name: Update and commit snapshots + if: steps.changes.outputs.code == 'true' id: update-snapshots run: | # Check if there are any changes to commit @@ -260,7 +297,7 @@ jobs: # Modify the final check step to handle different failure types - name: Check for failures - if: always() # Run this step even if previous steps failed + if: always() && steps.changes.outputs.code == 'true' run: | echo "Test Storybook Outcome: ${{ steps.test-storybook.outcome }}" echo "Snapshot Failed (changes detected in PR diff): ${{ env.snapshot_failed }}"