Skip to content

Commit 2e9aa49

Browse files
committed
feat: action menu (#183)
1 parent 95808f4 commit 2e9aa49

73 files changed

Lines changed: 12582 additions & 307 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish-canary-release.yaml

Lines changed: 66 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,44 @@ name: Publish canary release
33
on:
44
workflow_dispatch:
55
inputs:
6+
package:
7+
description: "Which package(s) to release"
8+
type: choice
9+
options: [filters, action-menu, both]
10+
required: true
11+
bump_type:
12+
description: "Bump type"
13+
type: choice
14+
options: [patch, minor, major]
15+
default: patch
16+
npm_tag:
17+
description: "npm dist-tag"
18+
type: choice
19+
options: [canary, latest]
20+
default: canary
621
dry_run:
7-
description: 'Run in dry-run mode (no actual publishing or git commits)'
8-
required: false
9-
default: false
22+
description: "Run in dry-run mode (no publish or git push)"
1023
type: boolean
11-
pull_request:
12-
branches: [canary]
24+
default: false
1325

1426
jobs:
1527
publish-canary:
1628
permissions:
1729
contents: write
1830
runs-on: ubuntu-24.04
31+
# serialize matrix to avoid concurrent commits/tags racing
32+
strategy:
33+
max-parallel: 1
34+
matrix:
35+
package: [filters, action-menu]
36+
37+
# Skip matrix rows not selected by input
38+
if: >
39+
github.event_name == 'pull_request' ||
40+
inputs.package == 'both' ||
41+
(inputs.package == 'filters' && matrix.package == 'filters') ||
42+
(inputs.package == 'action-menu' && matrix.package == 'action-menu')
43+
1944
steps:
2045
- name: Checkout
2146
uses: actions/checkout@v4
@@ -25,7 +50,7 @@ jobs:
2550

2651
- name: Configure Git
2752
run: |
28-
git config user.name "${{ github.actor }}"
53+
git config user.name "${{ github.actor }}"
2954
git config user.email "${{ github.actor }}@users.noreply.github.com"
3055
3156
- name: Setup Bun
@@ -47,24 +72,46 @@ jobs:
4772
env:
4873
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4974

50-
- name: Build and publish
75+
- name: Build & release ${{ matrix.package }}
76+
working-directory: packages/${{ matrix.package }}
5177
env:
5278
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5379
run: |
54-
cd packages/filters
80+
# build (your publish.ts runs tests again as well)
5581
bun run build
56-
if [[ "${{ github.event_name }}" == "pull_request" ]] || [[ "${{ inputs.dry_run }}" == "true" ]]; then
57-
bun run release:patch:canary --no-git-tag --dry-run
58-
else
59-
bun run release:patch:canary --no-git-tag
82+
83+
# Decide flags based on event + dry_run
84+
EXTRA_FLAGS="--no-git-tag --tag ${{ inputs.npm_tag }}"
85+
if [[ "${{ github.event_name }}" == "pull_request" || "${{ inputs.dry_run }}" == "true" ]]; then
86+
EXTRA_FLAGS="$EXTRA_FLAGS --dry-run"
6087
fi
6188
62-
- name: Commit version changes
89+
# Call your release script directly (uses your custom versioning)
90+
bun scripts/release.ts --bump ${{ inputs.bump_type }} --path . $EXTRA_FLAGS
91+
92+
- name: Commit version bump for ${{ matrix.package }}
93+
if: github.event_name != 'pull_request' && !inputs.dry_run
94+
working-directory: packages/${{ matrix.package }}
95+
run: |
96+
PKG_NAME=$(jq -r '.name' package.json)
97+
NEXT_VERSION=$(jq -r '.version' package.json)
98+
99+
git add package.json
100+
git commit -m "release(${PKG_NAME}): v${NEXT_VERSION}"
101+
102+
- name: Create per-package tag for ${{ matrix.package }}
103+
if: github.event_name != 'pull_request' && !inputs.dry_run
104+
working-directory: packages/${{ matrix.package }}
105+
run: |
106+
PKG_NAME=$(jq -r '.name' package.json)
107+
NEXT_VERSION=$(jq -r '.version' package.json)
108+
# Sanitize tag so it doesn't contain '/'
109+
TAG_NAME="${PKG_NAME}@${NEXT_VERSION}"
110+
111+
git tag "$TAG_NAME"
112+
git push origin "$TAG_NAME"
113+
114+
- name: Push branch (after commit)
63115
if: github.event_name != 'pull_request' && !inputs.dry_run
64116
run: |
65-
NEXT_VERSION="v$(cat packages/filters/package.json | jq ".version" -r)"
66-
git add packages/filters/package.json
67-
git commit --amend --no-edit --no-verify
68-
git tag $NEXT_VERSION
69-
git push origin HEAD --force-with-lease --no-verify
70-
git push origin $NEXT_VERSION --no-verify
117+
git push origin HEAD

.prototools

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
bun = "1.2.4"
1+
bun = "1.2.21"
22
node = "~22"
33

44
[settings]

0 commit comments

Comments
 (0)