Repository navigation
ci: create GitHub releases after npm publishing - #257
yowainwright wants to merge 1 commit into
Conversation
Reviewer's GuideConfigurationAdd a job after npm publishing that creates a GitHub release for the existing tag and skips tags that already have a release.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/release.yml" line_range="90-94" />
<code_context>
+ - name: Create release
+ timeout-minutes: 2
+ run: |
+ if gh release view "$TAG" >/dev/null 2>&1; then
+ echo "Release $TAG already exists"
+ exit 0
+ fi
+ gh release create "$TAG" --verify-tag --generate-notes
</code_context>
<issue_to_address>
**Concurrent release runs fail**
When two runs for the same tag reach the release job at the same time, `gh release view` lets both runs proceed, then the second `gh release create` fails because the release already exists, so its workflow run reports failure despite the release existing.
Make release creation idempotent so a concurrent already-exists result is treated as success.
</issue_to_address>
### Comment 2
<location path=".github/workflows/release.yml" line_range="75-94" />
<code_context>
exit 1
fi
+
+ github-release:
+ name: Create GitHub release
+ needs: publish
+ runs-on: ubuntu-latest
+ timeout-minutes: 5
+ permissions:
+ contents: write
+ env:
+ TAG: ${{ github.ref_name }}
+ GH_TOKEN: ${{ github.token }}
+ GH_REPO: ${{ github.repository }}
+ steps:
+ - name: Create release
+ timeout-minutes: 2
+ run: |
+ if gh release view "$TAG" >/dev/null 2>&1; then
+ echo "Release $TAG already exists"
+ exit 0
+ fi
+ gh release create "$TAG" --verify-tag --generate-notes
</code_context>
<issue_to_address>
**Release notes use wrong baseline**
When an earlier tag's release job is delayed while a later tag's publish and release finish first, the concurrency group serializes only `publish`, so a later tag's `github-release` job can create its release before an earlier tag's job. `--generate-notes` can then use the wrong previous release as its baseline, producing notes that include changes from the earlier release.
Serialize release creation in tag order or specify the intended previous tag when generating notes.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and the job uses a write-scoped GitHub token to create a public release for the published tag. If it creates the wrong release, reverting the workflow will not remove it, though the release can be deleted or corrected.
Blocking findings: .github/workflows/release.yml:94, .github/workflows/release.yml:94
| if gh release view "$TAG" >/dev/null 2>&1; then | ||
| echo "Release $TAG already exists" | ||
| exit 0 | ||
| fi | ||
| gh release create "$TAG" --verify-tag --generate-notes |
There was a problem hiding this comment.
🟡 Medium · Concurrent release runs fail
When two runs for the same tag reach the release job at the same time, gh release view lets both runs proceed, then the second gh release create fails because the release already exists, so its workflow run reports failure despite the release existing.
Make release creation idempotent so a concurrent already-exists result is treated as success.
Prompt for AI agents
In `.github/workflows/release.yml` at lines 90-94:
**Concurrent release runs fail**
When two runs for the same tag reach the release job at the same time, `gh release view` lets both runs proceed, then the second `gh release create` fails because the release already exists, so its workflow run reports failure despite the release existing.
Make release creation idempotent so a concurrent already-exists result is treated as success.| github-release: | ||
| name: Create GitHub release | ||
| needs: publish | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| permissions: | ||
| contents: write | ||
| env: | ||
| TAG: ${{ github.ref_name }} | ||
| GH_TOKEN: ${{ github.token }} | ||
| GH_REPO: ${{ github.repository }} | ||
| steps: | ||
| - name: Create release | ||
| timeout-minutes: 2 | ||
| run: | | ||
| if gh release view "$TAG" >/dev/null 2>&1; then | ||
| echo "Release $TAG already exists" | ||
| exit 0 | ||
| fi | ||
| gh release create "$TAG" --verify-tag --generate-notes |
There was a problem hiding this comment.
🟡 Medium · Release notes use wrong baseline
When an earlier tag's release job is delayed while a later tag's publish and release finish first, the concurrency group serializes only publish, so a later tag's github-release job can create its release before an earlier tag's job. --generate-notes can then use the wrong previous release as its baseline, producing notes that include changes from the earlier release.
Serialize release creation in tag order or specify the intended previous tag when generating notes.
Prompt for AI agents
In `.github/workflows/release.yml` at lines 75-94:
**Release notes use wrong baseline**
When an earlier tag's release job is delayed while a later tag's publish and release finish first, the concurrency group serializes only `publish`, so a later tag's `github-release` job can create its release before an earlier tag's job. `--generate-notes` can then use the wrong previous release as its baseline, producing notes that include changes from the earlier release.
Serialize release creation in tag order or specify the intended previous tag when generating notes.
The release workflow currently publishes to npm without creating a GitHub release. Add the release-job pattern from koajs/router after successful npm publishing: require an existing tag, generate the release title and notes, and skip releases that already exist on retries. Grant
contents: writeonly to the new job.Validation:
npm run validate: lint, formatting, typecheck, build, and all 74 tests passed.queue: maxkey omitted in memory because the installed actionlint does not support it.ghcommand.Summary by Sourcery
Add an isolated post-publish job that creates GitHub releases with generated notes for tagged npm releases.
New Features:
Enhancements:
Summary by CodeRabbit