Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 0 additions & 61 deletions .github/workflows/publish.yml

This file was deleted.

48 changes: 47 additions & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,56 @@ permissions:

jobs:
release-please:
name: Create/Update Release PR
name: Release PR + Publish
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json

- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}

- uses: pnpm/action-setup@v2
if: ${{ steps.release.outputs.release_created }}
with:
version: 10

- uses: actions/setup-node@v4
if: ${{ steps.release.outputs.release_created }}
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'

- name: Install
if: ${{ steps.release.outputs.release_created }}
run: pnpm install --frozen-lockfile

- name: Check if version already published
if: ${{ steps.release.outputs.release_created }}
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: ${{ steps.release.outputs.release_created && env.SKIP_PUBLISH != 'true' }}
run: |
pnpm lint
pnpm format:check
pnpm type-check
pnpm test
pnpm build

- name: Publish
if: ${{ steps.release.outputs.release_created && env.SKIP_PUBLISH != 'true' }}
run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7 changes: 3 additions & 4 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ We use a clean OSS-style flow:
- PRs merge into `master` (nothing publishes on merge)
- A release is created by a dedicated **Release PR** opened/updated automatically
- When the Release PR is merged, CI creates a git tag like `v1.2.3`
- Tag pushes trigger CI to publish to npm
- When a release tag is created, CI publishes to npm automatically

## One-time setup (maintainers)

Expand Down Expand Up @@ -37,9 +37,8 @@ We use a clean OSS-style flow:

3. When you're ready to ship, merge the Release PR.
- This creates a git tag `vX.Y.Z` and a GitHub Release
- The `Publish` workflow runs on the tag and publishes to npm
- The `Release Please` workflow publishes to npm as part of the same run

## Notes

- Publishing is triggered only by `v*` tags.
- The publish workflow verifies `tag == v${package.json.version}` and fails fast if they don't match.
- If a version is already published on npm, CI skips the publish step (useful when seeding historical tags).
29 changes: 0 additions & 29 deletions scripts/ci/ensure-tag-matches-package.mjs

This file was deleted.

Loading