Skip to content

Commit 185405f

Browse files
committed
fix: move release-please pr creation and public publishing to separate workflow and job
1 parent c402b9c commit 185405f

File tree

2 files changed

+70
-44
lines changed

2 files changed

+70
-44
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: release-please-pr
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
branches:
8+
- master
9+
10+
jobs:
11+
release-pr:
12+
runs-on: ubuntu-latest
13+
if: ${{ github.event.pull_request.merged == true && !startsWith(github.head_ref, 'release-please--branches--') }}
14+
env:
15+
YARN_RC_FILENAME: .yarnrc-public.yml
16+
steps:
17+
- uses: actions/setup-node@v6
18+
with:
19+
node-version: '24.11.0'
20+
- uses: google-github-actions/release-please-action@v3
21+
id: release-please
22+
with:
23+
release-type: node
24+
package-name: '@appfolio/react-gears'
25+
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{"type":"refactor","section":"Miscellaneous","hidden":false}]'
26+
command: release-pr
27+
- uses: actions/github-script@v5
28+
if: ${{ steps.release-please.outputs.pr }}
29+
id: extract-branch
30+
env:
31+
PR_NUM: ${{ steps.release-please.outputs.pr }}
32+
with:
33+
result-encoding: string
34+
script: return JSON.parse(process.env.PR_NUM).headBranchName
35+
- uses: actions/checkout@v5
36+
if: ${{ steps.release-please.outputs.pr }}
37+
with:
38+
ref: ${{ steps.extract-branch.outputs.result }}
39+
- run: yarn install --immutable
40+
if: ${{ steps.release-please.outputs.pr }}
41+
- run: yarn docs
42+
if: ${{ steps.release-please.outputs.pr }}
43+
- uses: stefanzweifel/git-auto-commit-action@v4
44+
if: ${{ steps.release-please.outputs.pr }}
45+
with:
46+
commit_message: 'docs: update documentation for the latest release'

.github/workflows/release-please.yml

Lines changed: 24 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,7 @@ on:
66
name: release-please
77

88
jobs:
9-
release-pr:
10-
runs-on: ubuntu-latest
11-
environment: ci
12-
env:
13-
CODEARTIFACT_REGISTRY_SERVER: ${{ vars.CODEARTIFACT_REGISTRY_SERVER }}
14-
steps:
15-
- uses: actions/setup-node@v6
16-
with:
17-
node-version: '24.11.0'
18-
- uses: google-github-actions/release-please-action@v3
19-
id: release-please
20-
with:
21-
release-type: node
22-
package-name: '@appfolio/react-gears'
23-
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{"type":"refactor","section":"Miscellaneous","hidden":false}]'
24-
command: release-pr
25-
- uses: actions/github-script@v5
26-
if: ${{ steps.release-please.outputs.pr }}
27-
id: extract-branch
28-
env:
29-
PR_NUM: ${{ steps.release-please.outputs.pr }}
30-
with:
31-
result-encoding: string
32-
script: return JSON.parse(process.env.PR_NUM).headBranchName
33-
- uses: actions/checkout@v5
34-
if: ${{ steps.release-please.outputs.pr }}
35-
with:
36-
ref: ${{ steps.extract-branch.outputs.result }}
37-
- uses: ./.github/actions/prep-secure-registries
38-
if: ${{ steps.release-please.outputs.pr }}
39-
with:
40-
aws-access-key-id: ${{ secrets.SHARED_CODEARTIFACT_AWS_KEY_ID }}
41-
aws-secret-access-key: ${{ secrets.SHARED_CODEARTIFACT_AWS_SECRET_KEY }}
42-
- run: yarn install --immutable
43-
if: ${{ steps.release-please.outputs.pr }}
44-
- run: yarn docs
45-
if: ${{ steps.release-please.outputs.pr }}
46-
- uses: stefanzweifel/git-auto-commit-action@v4
47-
if: ${{ steps.release-please.outputs.pr }}
48-
with:
49-
commit_message: 'docs: update documentation for the latest release'
50-
51-
release:
9+
release-github:
5210
runs-on: ubuntu-latest
5311
environment: ci
5412
env:
@@ -75,14 +33,36 @@ jobs:
7533
if: ${{ steps.release.outputs.release_created }}
7634
- run: yarn dist
7735
if: ${{ steps.release.outputs.release_created }}
36+
- name: Upload artifacts
37+
uses: actions/upload-artifact@v4
38+
if: ${{ steps.release.outputs.release_created }}
39+
with:
40+
name: dist
41+
path: dist/
42+
retention-days: 1
43+
if-no-files-found: error
7844
- name: Publish to GitHub
7945
run: |
8046
npm config set registry https://npm.pkg.github.com
8147
npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}
8248
npm publish
8349
if: ${{ steps.release.outputs.release_created }}
50+
51+
release-public:
52+
runs-on: ubuntu-latest
53+
needs: release-github
54+
env:
55+
YARN_RC_FILENAME: .yarnrc-public.yml
56+
steps:
57+
- uses: actions/checkout@v5
58+
- uses: actions/setup-node@v6
59+
with:
60+
node-version-file: '.tool-versions'
61+
- name: Download dist artifacts
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: dist
8465
- name: Publish to npm
8566
run: |
8667
npm config set registry https://registry.npmjs.org
8768
npm publish --access public
88-
if: ${{ steps.release.outputs.release_created }}

0 commit comments

Comments
 (0)