Skip to content

Commit 77ed28d

Browse files
frantic1048claude
andcommitted
feat: migrate from beachball to nx release workflow
Replace beachball versioning/publishing with Nx Release + release-pr workflow. Add version plan checks, renovate auto-plan, and prerelease publishing via GitHub Actions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7552f3e commit 77ed28d

17 files changed

Lines changed: 750 additions & 1970 deletions

.github/workflows/ci.yml

Lines changed: 47 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
uses: pnpm/action-setup@v4
2525

2626
- name: Prepare Node.js
27-
uses: actions/setup-node@v6.0.0
27+
uses: actions/setup-node@v6
2828
with:
2929
node-version-file: .node-version
3030
cache: pnpm
@@ -35,75 +35,66 @@ jobs:
3535
- name: Lint
3636
run: pnpm run lint
3737

38-
check-renovate-changefile:
39-
if: startsWith(github.event.pull_request.head.ref, 'renovate/') && github.base_ref == github.event.repository.default_branch
38+
check-version-plan:
4039
needs: install
40+
if: github.base_ref == github.event.repository.default_branch && github.head_ref != 'release' && !startsWith(github.head_ref, 'renovate/')
4141
runs-on: ubuntu-latest
4242
steps:
43-
- uses: actions/checkout@v6
43+
- name: Checkout
44+
uses: actions/checkout@v6
4445
with:
45-
ref: ${{ github.event.pull_request.head.ref }}
46-
token: ${{ secrets.RENOVATE_AUTO_BEACHBALL_CHANGEFILE_TOKEN }}
46+
fetch-depth: 0
47+
48+
- name: Prepare pnpm
49+
uses: pnpm/action-setup@v4
4750

48-
# Install dependencies (example using pnpm)
49-
- uses: pnpm/action-setup@v4
50-
- uses: actions/setup-node@v5
51+
- name: Prepare Node.js
52+
uses: actions/setup-node@v6
5153
with:
5254
node-version-file: .node-version
5355
cache: pnpm
54-
- run: pnpm install
5556

56-
- name: Check and generate changefile for Renovate
57-
# Pin to the last commit on main before this action was removed (replaced by renovate-auto-version-plan)
58-
uses: RightCapitalHQ/frontend-style-guide/.github/actions/renovate-auto-beachball-changefile@e7e6cdd89b0a5e56bb7b1b5280aae241d9e4e848
57+
- name: Install dependencies
58+
run: pnpm install
5959

60-
check-beachball-changefile:
61-
if: github.base_ref == github.event.repository.default_branch
62-
needs: install
63-
runs-on: ubuntu-latest
64-
steps:
65-
- uses: actions/checkout@v6
66-
- uses: pnpm/action-setup@v4
67-
- uses: actions/setup-node@v6.0.0
68-
with:
69-
node-version-file: .node-version
70-
cache: pnpm
71-
- run: pnpm install
60+
- name: Set SHAs for Nx
61+
uses: nrwl/nx-set-shas@v4
62+
63+
- name: Check version plan
64+
run: pnpm exec nx release plan:check
7265

73-
- name: Check
74-
run: pnpm exec beachball check
66+
check-renovate-version-plan:
67+
needs: install
68+
if: startsWith(github.event.pull_request.head.ref, 'renovate/') && github.base_ref == github.event.repository.default_branch
69+
uses: RightCapitalHQ/actions/.github/workflows/nx-release-auto-plan.yml@nx-release-auto-plan/v0.4.2
70+
secrets: inherit
7571

76-
build:
77-
if: ${{ always() && !failure() && !cancelled() }}
78-
needs: check-beachball-changefile
72+
prerelease:
73+
if: >-
74+
!failure() && !cancelled()
75+
&& github.event_name == 'pull_request'
76+
&& github.event.pull_request.head.repo.full_name == 'RightCapitalHQ/php-parser'
77+
&& github.base_ref == github.event.repository.default_branch
78+
&& github.head_ref != 'release'
79+
needs: [install, check-version-plan, check-renovate-version-plan]
7980
runs-on: ubuntu-latest
80-
permissions:
81-
id-token: write
82-
contents: write
8381
steps:
84-
- uses: actions/checkout@v6
85-
- uses: pnpm/action-setup@v4
86-
- uses: actions/setup-node@v6.0.0
82+
- uses: actions/create-github-app-token@v3
83+
id: app-token
8784
with:
88-
node-version-file: .node-version
89-
cache: pnpm
90-
- run: pnpm install
91-
92-
- name: Build
93-
run: pnpm run build
94-
95-
- name: Publish (development)
96-
if: github.repository == 'RightCapitalHQ/php-parser' && github.base_ref == github.event.repository.default_branch
85+
app-id: ${{ secrets.RC_BOT_APP_ID }}
86+
private-key: ${{ secrets.RC_BOT_PRIVATE_KEY }}
87+
permission-actions: write
88+
- name: Trigger prerelease workflow
9789
env:
98-
HEAD_REF: ${{ github.head_ref }}
99-
run: |
100-
preid="${HEAD_REF//\//-}".${{ github.run_number }}.${{ github.run_attempt }}
101-
npm --no-git-tag-version version prerelease --preid="${preid}"
102-
pnpm publish --no-git-checks --access public --tag development
103-
104-
- name: Publish (main)
105-
if: github.repository == 'RightCapitalHQ/php-parser' && github.ref_name == github.event.repository.default_branch
90+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
91+
BRANCH_NAME: ${{ github.head_ref }}
92+
RUN_NUMBER: ${{ github.run_number }}
93+
RUN_ATTEMPT: ${{ github.run_attempt }}
10694
run: |
107-
git config --local user.email "npm-publisher@rightcapital.com"
108-
git config --local user.name "GitHub Actions[bot]"
109-
pnpm beachball publish --access public --yes -m 'chore(release): applying package updates'
95+
gh workflow run release.yml \
96+
--repo "$GITHUB_REPOSITORY" \
97+
-f prerelease=true \
98+
-f "branch_name=${BRANCH_NAME}" \
99+
-f "run_number=${RUN_NUMBER}" \
100+
-f "run_attempt=${RUN_ATTEMPT}"

.github/workflows/release-pr.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Release PR
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
create-release-pr:
10+
uses: RightCapitalHQ/actions/.github/workflows/nx-release-pr.yml@nx-release-pr/v0.4.2
11+
with:
12+
release-branch: release
13+
base: main
14+
pr-title: 'chore(release): release packages'
15+
secrets: inherit

.github/workflows/release.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches: [main]
7+
8+
workflow_dispatch:
9+
inputs:
10+
prerelease:
11+
required: true
12+
type: boolean
13+
branch_name:
14+
required: true
15+
type: string
16+
run_number:
17+
required: true
18+
type: string
19+
run_attempt:
20+
required: true
21+
type: string
22+
23+
jobs:
24+
release:
25+
if: >-
26+
github.event_name == 'pull_request'
27+
&& github.event.pull_request.merged == true
28+
&& github.event.pull_request.head.ref == 'release'
29+
uses: RightCapitalHQ/actions/.github/workflows/nx-release.yml@nx-release/v0.4.2
30+
with:
31+
publish: true
32+
secrets: inherit
33+
34+
prerelease:
35+
if: inputs.prerelease
36+
runs-on: ubuntu-latest
37+
permissions:
38+
id-token: write
39+
contents: read
40+
steps:
41+
- uses: actions/checkout@v6
42+
with:
43+
ref: ${{ inputs.branch_name }}
44+
persist-credentials: false
45+
46+
- name: Setup PHP with Composer
47+
uses: shivammathur/setup-php@v2
48+
with:
49+
php-version: '8.2'
50+
tools: composer
51+
52+
- uses: pnpm/action-setup@v4
53+
- uses: actions/setup-node@v6
54+
with:
55+
node-version-file: .node-version
56+
cache: pnpm
57+
- run: pnpm install
58+
59+
- name: Publish prerelease (development)
60+
env:
61+
BRANCH_NAME: ${{ inputs.branch_name }}
62+
RUN_NUMBER: ${{ inputs.run_number }}
63+
RUN_ATTEMPT: ${{ inputs.run_attempt }}
64+
NPM_CONFIG_PROVENANCE: true
65+
run: |
66+
preid="${BRANCH_NAME//\//-}".${RUN_NUMBER}.${RUN_ATTEMPT}
67+
npm --no-git-tag-version version prerelease --preid="${preid}"
68+
pnpm publish --no-git-checks --access public --tag development

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ logs
1212
*.log
1313
npm-debug.log*
1414
lerna-debug.log*
15+
16+
# nx
17+
/.nx/cache
18+
/.nx/workspace-data
19+
!/.nx/version-plans/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rightcapital/php-parser": patch
3+
---
4+
5+
Migrate from beachball to Nx Release workflow.

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ src/php-parser/types/node
33
src/php-parser/types/types.ts
44
pnpm-lock.yaml
55
composer.lock
6-
CHANGELOG.md
6+
CHANGELOG.md
7+
.nx/version-plans/

0 commit comments

Comments
 (0)