Skip to content

#84 - github-release-for-libs#85

Open
mumenthalers wants to merge 6 commits into
mainfrom
#84-github-release-for-libs
Open

#84 - github-release-for-libs#85
mumenthalers wants to merge 6 commits into
mainfrom
#84-github-release-for-libs

Conversation

@mumenthalers

@mumenthalers mumenthalers commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Implements automated GitHub Releases when publishing library versions, making it easier to track version history and changes.

Changes Made

  • packages/publish-helper/src/github-release.ts — New module with GitHub REST API helpers. publishConsolidatedRelease creates one consolidated GitHub Release per publish run (not one per package), listing all bumped packages as a Package Version Set with Changelog Links.
    • Stable releases: timestamped tag releases/YYYY-MM-DDTHH-MM-SS
    • PR pre-releases: per-PR tag releases/pr{N}, replaced on each new run to reflect the latest state
  • packages/publish-helper/src/publish-lib.tspublishMaster and publishPreRelease are now async. Both capture new package tags around the lerna calls and create a consolidated GitHub Release when GITHUB_REPOSITORY + GH_TOKEN are available. Shared getNewPackageTags helper avoids duplication.
  • packages/publish-helper/src/github-release.spec.ts — Tests for buildReleaseTag and buildReleaseBody.
  • CONTEXT.md — Added release communication domain glossary defining language for GitHub Releases (Release Run, Release Tag, Package Version Set, Changelog Link, etc.).

No workflow changes are needed — the existing GH_TOKEN env var already present in the Publish step is sufficient.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 10, 2026 13:21
@mumenthalers

Copy link
Copy Markdown
Contributor Author

@copilot implement issue #84

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds repository-level context for consistent terminology around communicating published library versions via GitHub Releases, intended to support a standardized release note/release record approach.

Changes:

  • Introduces CONTEXT.md defining release-related terms (Release Run, Release Tag, PR Tag, etc.).
  • Establishes preferred/avoided language for stable vs pre-release GitHub Releases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CONTEXT.md
Comment thread CONTEXT.md
- Add github-release.ts with helpers for GitHub REST API interactions
- publishConsolidatedRelease creates one GitHub Release per publish run
  listing all bumped packages (Package Version Set) with Changelog Links
- Stable releases: timestamped tag releases/YYYY-MM-DDTHH-MM-SS
- Pre-releases: per-PR tag releases/pr{N}, replaced on each run
- publishMaster and publishPreRelease now async; both create releases
  when repository + GH_TOKEN are available
- Add github-release.spec.ts with tests for buildReleaseTag / buildReleaseBody

closes #84

Co-authored-by: mumenthalers <3604424+mumenthalers@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 10, 2026 13:31
@mumenthalers mumenthalers removed the request for review from Copilot July 10, 2026 13:31
…lease name from tag

Co-authored-by: mumenthalers <3604424+mumenthalers@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 10, 2026 13:33
@mumenthalers mumenthalers removed the request for review from Copilot July 10, 2026 13:33

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown

@copilot implement issue #84

Implemented in commits feat(publish-helper): create consolidated GitHub Releases on publish and the follow-up refactor.

What was added:

  • packages/publish-helper/src/github-release.ts — New module with GitHub REST API helpers. publishConsolidatedRelease creates one consolidated GitHub Release per publish run, listing all bumped packages (Package Version Set) with Changelog Links.
    • Stable releases: timestamped tag releases/YYYY-MM-DDTHH-MM-SS
    • PR pre-releases: per-PR tag releases/pr{N} (existing release is replaced on each new run so it always reflects the latest state)
  • packages/publish-helper/src/publish-lib.tspublishMaster and publishPreRelease are now async. Both capture new package tags around the lerna calls and create a consolidated GitHub Release when GITHUB_REPOSITORY + GH_TOKEN are available.
  • packages/publish-helper/src/github-release.spec.ts — Tests for buildReleaseTag and buildReleaseBody.

No workflow changes needed — the existing GH_TOKEN and GITHUB_CONTEXT env vars already passed to the publish step are sufficient.

 - @shiftcode/publish-helper@6.1.0-pr84.0
Copilot AI review requested due to automatic review settings July 10, 2026 15:24
@mumenthalers

Copy link
Copy Markdown
Contributor Author

@copilot
fix it. it didn't work. look at this ci output:

Successfully published:
lerna success published 1 package
 - @shiftcode/publish-helper@6.1.0-pr84.0
>>> git tag -d $(git describe --abbrev=0)
Deleted tag '@shiftcode/publish-helper@6.1.0-pr84.0' (was 64ff086)
>>> git push
To https://github.com/shiftcode/sc-commons-public.git
   d21a686..c0d4d46  #84-github-release-for-libs -> #84-github-release-for-libs
>>> git tag -l
publish-libs:: New package tags: none
publish-libs:: No new package tags – skipping GitHub Release creation.
publish-libs:: DONE

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.

Comment on lines 143 to +149
exec('git tag -d $(git describe --abbrev=0)')
exec('git push')

if (ghToken) {
const newPackageTags = getNewPackageTags(tagsBefore)
log(`New package tags: ${newPackageTags.join(', ') || 'none'}`)
await publishConsolidatedRelease(repository, ghToken, newPackageTags, true, preId, event.pull_request.head.sha)
Comment on lines +48 to +49
let body = ''
res.on('data', (chunk: string) => (body += chunk))
Comment on lines +86 to +90
try {
return await githubApiRequest<GithubRelease>('GET', `/repos/${repository}/releases/tags/${tagName}`, token)
} catch {
return null
}
Comment thread packages/publish-helper/src/github-release.ts Outdated
Comment thread packages/publish-helper/src/github-release.ts Outdated
{
"name": "@shiftcode/publish-helper",
"version": "6.0.0",
"version": "6.1.0-pr84.0",
…, fix API error handling

Co-authored-by: mumenthalers <3604424+mumenthalers@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 10, 2026 15:35
@mumenthalers mumenthalers removed the request for review from Copilot July 10, 2026 15:35
…required

Co-authored-by: mumenthalers <3604424+mumenthalers@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 10, 2026 15:37
@mumenthalers mumenthalers removed the request for review from Copilot July 10, 2026 15:37

Copilot AI commented Jul 10, 2026

Copy link
Copy Markdown

@copilot
fix it. it didn't work. look at this ci output:

...

Fixed in commit fix(publish-helper): capture new package tags before git tag deletion, fix API error handling.

Root cause: getNewPackageTags(tagsBefore) was called after exec('git tag -d $(git describe --abbrev=0)'), which deleted the freshly created lerna tag before we could see it. Moving the capture to immediately after execLerna('publish', ...) and before the tag deletion resolves the issue.

Also fixed in this PR:

  • getExistingRelease now only swallows 404 and re-throws all other API errors (403, 5xx, rate limits) to prevent silent createRelease failures
  • IncomingMessage response stream now has explicit UTF-8 encoding set before reading chunks
  • Changelog links in the release body now use the actual targetCommitish ref instead of hardcoded blob/main
  • ApiError is now exported; buildReleaseBody ref parameter is now required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants