Skip to content

Commit 1e71637

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) <[email protected]>
1 parent 96c14f0 commit 1e71637

18 files changed

Lines changed: 782 additions & 4122 deletions

.github/workflows/ci.yml

Lines changed: 61 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,28 @@ on:
66
branches: [main]
77
workflow_dispatch:
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
install:
1114
runs-on: ubuntu-latest
1215
steps:
13-
- uses: actions/checkout@v4
14-
- uses: pnpm/action-setup@v4
15-
- uses: actions/[email protected]
16-
with:
17-
node-version-file: .node-version
18-
cache: pnpm
19-
- run: pnpm install
20-
21-
check-renovate-changefile:
22-
if: startsWith(github.event.pull_request.head.ref, 'renovate/') && github.base_ref == github.event.repository.default_branch
23-
needs: install
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v4
27-
with:
28-
ref: ${{ github.event.pull_request.head.ref }}
29-
token: ${{ secrets.RENOVATE_AUTO_BEACHBALL_CHANGEFILE_TOKEN }}
30-
31-
# Install dependencies (example using pnpm)
32-
- uses: pnpm/action-setup@v4
33-
- uses: actions/setup-node@v4
34-
with:
35-
node-version-file: .node-version
36-
cache: pnpm
37-
- run: pnpm install
38-
39-
- name: Check and generate changefile for Renovate
40-
# Pin to the last commit on main before this action was removed (replaced by renovate-auto-version-plan)
41-
uses: RightCapitalHQ/frontend-style-guide/.github/actions/renovate-auto-beachball-changefile@e7e6cdd89b0a5e56bb7b1b5280aae241d9e4e848
42-
43-
check-beachball-changefile:
44-
if: github.base_ref == github.event.repository.default_branch
45-
needs: install
46-
runs-on: ubuntu-latest
47-
steps:
48-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v6
4917
- uses: pnpm/action-setup@v4
50-
- uses: actions/setup-node@v4.4.0
18+
- uses: actions/setup-node@v6
5119
with:
5220
node-version-file: .node-version
5321
cache: pnpm
5422
- run: pnpm install
5523

56-
- name: Check
57-
run: pnpm exec beachball check
58-
5924
test:
6025
needs: install
6126
runs-on: ubuntu-latest
6227
steps:
63-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v6
6429
- uses: pnpm/action-setup@v4
65-
- uses: actions/setup-node@v4.4.0
30+
- uses: actions/setup-node@v6
6631
with:
6732
node-version-file: .node-version
6833
cache: pnpm
@@ -77,40 +42,66 @@ jobs:
7742
- name: Test
7843
run: pnpm run test
7944

80-
build:
81-
if: ${{ always() && !failure() && !cancelled() }}
82-
needs: [test, check-beachball-changefile]
45+
check-version-plan:
46+
needs: install
47+
if: github.base_ref == github.event.repository.default_branch && github.head_ref != 'release' && !startsWith(github.head_ref, 'renovate/')
8348
runs-on: ubuntu-latest
84-
permissions:
85-
id-token: write
86-
contents: write
8749
steps:
88-
- uses: actions/checkout@v4
89-
- uses: pnpm/action-setup@v4
90-
- uses: actions/[email protected]
50+
- name: Checkout
51+
uses: actions/checkout@v6
52+
with:
53+
fetch-depth: 0
54+
55+
- name: Prepare pnpm
56+
uses: pnpm/action-setup@v4
57+
58+
- name: Prepare Node.js
59+
uses: actions/setup-node@v6
9160
with:
9261
node-version-file: .node-version
9362
cache: pnpm
94-
- run: pnpm install
9563

96-
- name: Build
97-
run: pnpm run build
64+
- name: Install dependencies
65+
run: pnpm install
9866

99-
- name: Publish (development)
100-
if: >-
101-
github.repository == 'RightCapitalHQ/phpdoc-parser' &&
102-
(github.base_ref == github.event.repository.default_branch ||
103-
(github.event_name == 'workflow_dispatch' && github.ref_name != github.event.repository.default_branch))
104-
env:
105-
HEAD_REF: ${{ github.head_ref || github.ref_name }}
106-
run: |
107-
preid="${HEAD_REF//\//-}".${{ github.run_number }}.${{ github.run_attempt }}
108-
npm --no-git-tag-version version prerelease --preid="${preid}"
109-
pnpm publish --no-git-checks --access public --tag development
67+
- name: Set SHAs for Nx
68+
uses: nrwl/nx-set-shas@v4
69+
70+
- name: Check version plan
71+
run: pnpm exec nx release plan:check
72+
73+
check-renovate-version-plan:
74+
needs: install
75+
if: startsWith(github.event.pull_request.head.ref, 'renovate/') && github.base_ref == github.event.repository.default_branch
76+
uses: RightCapitalHQ/actions/.github/workflows/nx-release-auto-plan.yml@nx-release-auto-plan/v0.4.2
77+
secrets: inherit
11078

111-
- name: Publish (main)
112-
if: github.repository == 'RightCapitalHQ/phpdoc-parser' && github.ref_name == github.event.repository.default_branch
79+
prerelease:
80+
if: >-
81+
!failure() && !cancelled()
82+
&& github.event_name == 'pull_request'
83+
&& github.event.pull_request.head.repo.full_name == 'RightCapitalHQ/phpdoc-parser'
84+
&& github.base_ref == github.event.repository.default_branch
85+
&& github.head_ref != 'release'
86+
needs: [test, check-version-plan, check-renovate-version-plan]
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/create-github-app-token@v3
90+
id: app-token
91+
with:
92+
app-id: ${{ secrets.RC_BOT_APP_ID }}
93+
private-key: ${{ secrets.RC_BOT_PRIVATE_KEY }}
94+
permission-actions: write
95+
- name: Trigger prerelease workflow
96+
env:
97+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
98+
BRANCH_NAME: ${{ github.head_ref }}
99+
RUN_NUMBER: ${{ github.run_number }}
100+
RUN_ATTEMPT: ${{ github.run_attempt }}
113101
run: |
114-
git config --local user.email "[email protected]"
115-
git config --local user.name "GitHub Actions[bot]"
116-
pnpm beachball publish --access public --yes -m 'chore(release): applying package updates'
102+
gh workflow run release.yml \
103+
--repo "$GITHUB_REPOSITORY" \
104+
-f prerelease=true \
105+
-f "branch_name=${BRANCH_NAME}" \
106+
-f "run_number=${RUN_NUMBER}" \
107+
-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: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
- uses: pnpm/action-setup@v4
46+
- uses: actions/setup-node@v6
47+
with:
48+
node-version-file: .node-version
49+
cache: pnpm
50+
- run: pnpm install
51+
52+
- name: Publish prerelease (development)
53+
env:
54+
BRANCH_NAME: ${{ inputs.branch_name }}
55+
RUN_NUMBER: ${{ inputs.run_number }}
56+
RUN_ATTEMPT: ${{ inputs.run_attempt }}
57+
NPM_CONFIG_PROVENANCE: true
58+
run: |
59+
preid="${BRANCH_NAME//\//-}".${RUN_NUMBER}.${RUN_ATTEMPT}
60+
npm --no-git-tag-version version prerelease --preid="${preid}"
61+
pnpm publish --no-git-checks --access public --tag development

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,8 @@ dist/
6363

6464
### JetBrains development tool ###
6565
/.idea
66+
67+
# nx
68+
/.nx/cache
69+
/.nx/workspace-data
70+
!/.nx/version-plans/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@rightcapital/phpdoc-parser": patch
3+
---
4+
5+
Migrate from beachball to Nx Release workflow.

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# We need to ignore this cause this is auto-generated file
22
pnpm-lock.yaml
33
CHANGELOG.md
4-
CHANGELOG.json
4+
.nx/version-plans/

0 commit comments

Comments
 (0)