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}"
0 commit comments