diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c37a7f9..b0a3cb2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,6 +18,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + with: + fetch-depth: 0 # tags, to find the previous release - name: Install pnpm uses: pnpm/action-setup@v6 @@ -50,13 +52,18 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_ENV echo "Extracted version: $VERSION" - - name: Create draft release + - name: Create release env: GH_TOKEN: ${{ github.token }} run: | + # Previous stable tag, skipping beta tags such as v2.8.0-beta.. + PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match 'v*' --exclude '*-*' "${GITHUB_REF_NAME}^") + echo "Release notes since $PREVIOUS_TAG" gh release create "$GITHUB_REF_NAME" \ --title "Release v${VERSION}" \ - --draft + --generate-notes \ + --notes-start-tag "$PREVIOUS_TAG" \ + --latest publish-prerelease: name: Pre-release (develop) diff --git a/nodejs/AGENTS.md b/nodejs/AGENTS.md index a72e208..18cce34 100644 --- a/nodejs/AGENTS.md +++ b/nodejs/AGENTS.md @@ -4,7 +4,7 @@ Branches: `develop` is the integration branch, and `master` holds released code. Publishing is done by `.github/workflows/publish.yml`: -- Pushing a `v*` tag builds the package, runs `pnpm publish` to npm `latest` (OIDC trusted publishing) and creates a **draft** GitHub release. +- Pushing a `v*` tag builds the package, runs `pnpm publish` to npm `latest` (OIDC trusted publishing) and publishes a GitHub release marked latest, with notes generated from the PRs merged since the previous `vX.Y.Z` tag. - Every push to `develop` publishes `-beta..` to the npm `beta` tag. Nothing needs to be done by hand for this. Steps (shown for a minor release, `X.Y.0`): @@ -24,6 +24,6 @@ Steps (shown for a minor release, `X.Y.0`): ``` 5. Merge `master` back into `develop` and push, so the bump is on `develop`. 6. Confirm the "Publish to NPM" run for the tag passed, and that `npm view @hackmd/api dist-tags.latest` shows `X.Y.0`. The registry can take a minute or two to update. -7. Ask the maintainer to write release notes for the draft GitHub release and publish it. The workflow leaves it empty. +7. Check the GitHub release for `vX.Y.0`. Its notes are generated automatically; edit them if the release needs highlights or upgrade notes. For a patch or major release, use the same steps with the matching version number.