Skip to content

Commit e7737e9

Browse files
authored
fix(release): make release-please runnable and less personal (#11)
Remove CODEOWNERS requirement, switch to manifest config, and harden npm publish against already-published versions.
1 parent e7f72cd commit e7737e9

File tree

6 files changed

+34
-4
lines changed

6 files changed

+34
-4
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/publish.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,18 @@ jobs:
3535
env:
3636
GITHUB_REF_NAME: ${{ github.ref_name }}
3737

38+
- name: Check if version already published
39+
run: |
40+
VERSION="$(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json','utf8')).version)")"
41+
if npm view "codebase-context@${VERSION}" version >/dev/null 2>&1; then
42+
echo "Version ${VERSION} already exists on npm; skipping publish."
43+
echo "SKIP_PUBLISH=true" >> "$GITHUB_ENV"
44+
else
45+
echo "Version ${VERSION} not found on npm; will publish."
46+
fi
47+
3848
- name: Quality gates
49+
if: env.SKIP_PUBLISH != 'true'
3950
run: |
4051
pnpm lint
4152
pnpm format:check
@@ -44,6 +55,7 @@ jobs:
4455
pnpm build
4556
4657
- name: Publish
58+
if: env.SKIP_PUBLISH != 'true'
4759
run: pnpm publish --access public --no-git-checks
4860
env:
4961
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release-please.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
permissions:
88
contents: write
99
pull-requests: write
10+
issues: write
1011

1112
jobs:
1213
release-please:
@@ -15,5 +16,5 @@ jobs:
1516
steps:
1617
- uses: googleapis/release-please-action@v4
1718
with:
18-
release-type: node
19-
package-name: codebase-context
19+
config-file: release-please-config.json
20+
manifest-file: .release-please-manifest.json

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "1.4.0"
3+
}

RELEASING.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ We use a clean OSS-style flow:
2020
- Require PRs (no direct pushes)
2121
- Require the `Tests` workflow to pass
2222

23-
This repo also uses `CODEOWNERS` so PRs from non-owners require an approval from `@PatrickSys`.
23+
3. Allow Release Please to open PRs
24+
- GitHub: Settings > Actions > General
25+
- Set Workflow permissions to "Read and write"
26+
- Enable "Allow GitHub Actions to create and approve pull requests"
2427

2528
## Normal release flow
2629

release-please-config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"packages": {
3+
".": {
4+
"release-type": "node",
5+
"package-name": "codebase-context",
6+
"changelog-path": "CHANGELOG.md",
7+
"include-v-in-tag": true,
8+
"include-component-in-tag": false,
9+
"extra-files": ["pnpm-lock.yaml"]
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)