From a24a444ede257bfa170b0cec6e1a5ad113d9dc08 Mon Sep 17 00:00:00 2001 From: PatrickSys Date: Wed, 28 Jan 2026 20:04:50 +0100 Subject: [PATCH] fix(release): make release-please runnable and less personal Remove CODEOWNERS requirement, switch to manifest config, and harden npm publish against already-published versions. --- .github/CODEOWNERS | 1 - .github/workflows/publish.yml | 12 ++++++++++++ .github/workflows/release-please.yml | 5 +++-- .release-please-manifest.json | 3 +++ RELEASING.md | 5 ++++- release-please-config.json | 12 ++++++++++++ 6 files changed, 34 insertions(+), 4 deletions(-) delete mode 100644 .github/CODEOWNERS create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index c6f651c..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @PatrickSys diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 20202b3..fc81e1f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -35,7 +35,18 @@ jobs: env: GITHUB_REF_NAME: ${{ github.ref_name }} + - name: Check if version already published + run: | + VERSION="$(node -e "console.log(JSON.parse(require('fs').readFileSync('package.json','utf8')).version)")" + if npm view "codebase-context@${VERSION}" version >/dev/null 2>&1; then + echo "Version ${VERSION} already exists on npm; skipping publish." + echo "SKIP_PUBLISH=true" >> "$GITHUB_ENV" + else + echo "Version ${VERSION} not found on npm; will publish." + fi + - name: Quality gates + if: env.SKIP_PUBLISH != 'true' run: | pnpm lint pnpm format:check @@ -44,6 +55,7 @@ jobs: pnpm build - name: Publish + if: env.SKIP_PUBLISH != 'true' run: pnpm publish --access public --no-git-checks env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index b8ca6b0..b1a0138 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -7,6 +7,7 @@ on: permissions: contents: write pull-requests: write + issues: write jobs: release-please: @@ -15,5 +16,5 @@ jobs: steps: - uses: googleapis/release-please-action@v4 with: - release-type: node - package-name: codebase-context + config-file: release-please-config.json + manifest-file: .release-please-manifest.json diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..4c313f9 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.4.0" +} diff --git a/RELEASING.md b/RELEASING.md index 89bcb4d..721eb82 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -20,7 +20,10 @@ We use a clean OSS-style flow: - Require PRs (no direct pushes) - Require the `Tests` workflow to pass -This repo also uses `CODEOWNERS` so PRs from non-owners require an approval from `@PatrickSys`. +3. Allow Release Please to open PRs + - GitHub: Settings > Actions > General + - Set Workflow permissions to "Read and write" + - Enable "Allow GitHub Actions to create and approve pull requests" ## Normal release flow diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..476cd6a --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,12 @@ +{ + "packages": { + ".": { + "release-type": "node", + "package-name": "codebase-context", + "changelog-path": "CHANGELOG.md", + "include-v-in-tag": true, + "include-component-in-tag": false, + "extra-files": ["pnpm-lock.yaml"] + } + } +}