Skip to content

feat: harden workspace releases with Changesets and OIDC - #2336

Merged
Shurtu-gal merged 12 commits into
asyncapi:masterfrom
Shurtu-gal:feat/release-workflow-hardening
Nov 2, 2026
Merged

Shurtu-gal merged 12 commits into
asyncapi:masterfrom
Shurtu-gal:feat/release-workflow-hardening

Conversation

@Shurtu-gal

@Shurtu-gal Shurtu-gal commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Description

  • Keep Changesets for version PRs and restore the custom OIDC publisher for partial-release recovery.
  • Separate build/pack, npm publication and GitHub releases. Verify existing publications and recover missing releases from the complete manifest.
  • Use the previous CLI tag explicitly for release notes and restore asyncapi-bot commit identity.
  • Keep the action version in sync, CLI-only Latest and Slack failure reporting.

Sandbox verification: partial npm failure, failed-job retry and partial GitHub failure, successful full rerun. The full rerun skipped all npm publications and recovered the missing releases. Full suite skipped for this release-only test.

Announcement filtering will follow centrally in asyncapi/.github. Hold the generated production release PR until that fix lands.

Related issue(s)

Fixes #2321

@changeset-bot

changeset-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e6a0c6e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@asyncapi/cli Patch
@asyncapi/diff Patch
@asyncapi/optimizer Patch
@asyncapi/bundler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to To Triage in CLI - Kanban Oct 28, 2026
@Shurtu-gal Shurtu-gal changed the title Feat/release workflow hardening feat: release workflow Oct 28, 2026
@Shurtu-gal Shurtu-gal changed the title feat: release workflow feat: harden workspace releases with npm trusted publishing Oct 28, 2026
@Shurtu-gal Shurtu-gal changed the title feat: harden workspace releases with npm trusted publishing ci: harden workspace releases with Changesets and OIDC Oct 28, 2026
@Shurtu-gal

Copy link
Copy Markdown
Collaborator Author

Found out changesets/action supports OIDC now, so we can use its own publish flow and drop publish-trusted.js.

Successful run: https://github.com/asyncapi-actions-test/cli/actions/runs/40628802285

Tested diff major (92.0.0), bundler minor (90.3.0) and CLI patch (90.0.4), with optimizer unchanged. npm publication, provenance and GitHub releases checked. Full suite skipped for this release-only test.

@Shurtu-gal Shurtu-gal changed the title ci: harden workspace releases with Changesets and OIDC feat: harden workspace releases with Changesets and OIDC Oct 28, 2026
@Shurtu-gal

Copy link
Copy Markdown
Collaborator Author

I had made the changes to publish-trusted.js and it was working fine but as not needed I have dropped it.

Comment thread package.json Resolved

@princerajpoot20 princerajpoot20 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I’ll review this over the coming weekend. At first glance, one concern I have is...

@Shurtu-gal Shurtu-gal moved this from To Triage to In review in CLI - Kanban Oct 31, 2026
Comment on lines +140 to +160
if: needs.publish.outputs.published == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
fetch-depth: 0
persist-credentials: false
- name: Create package releases and retain the CLI v tag
shell: bash
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
run: node scripts/publish-trusted.js --package-releases-only
PUBLISHED_PACKAGES: ${{ needs.publish.outputs.published-packages }}
run: |
jq -e 'type == "array"' <<< "$PUBLISHED_PACKAGES" > /dev/null
for file in packages/diff/package.json packages/optimizer/package.json packages/bundler/package.json package.json; do
name=$(jq -r '.name' "$file")
version=$(jq -r '.version' "$file")
if ! jq -e --arg name "$name" --arg version "$version" 'any(.[]; .name == $name and .version == $version)' <<< "$PUBLISHED_PACKAGES" > /dev/null; then
continue

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This does not recover a partial release
changeset publish publishes the four packages at the same time. If two succeed and the command then exits non-zero, changesets/action still writes published=true and the successful packages into publishedPackages, then the step fails. This job’s if is only true when the publish job succeeds, so those GitHub Releases are never created

in case of full re-run.. Packages already on npm are omitted from the new publishedPackages list, the if above skips them, and published stays false... The missing GitHub Releases are never created. Re-running only the failed job works when publish succeeded and this job failed. It does not work when publish itself failed halfway, or when someone uses “Re-run all jobs”

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This I didn't know. I will probably reset to the older publish one with my changes. It works even if some are skipped etc. I will paste some links here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I had already written and tested publish-trusted.js, but dropped it after finding out Changesets supports OIDC now. Have brought it back with my earlier fixes as it handles skipped packages and partial releases too.

Tested a partial npm failure, retrying failed jobs and then a full rerun after a GitHub release failure here. Already published packages were skipped and the missing releases got created.

Comment on lines +163 to +169
tag="$name@$version"
latest=false
notes=(--notes "Release $tag.")
if [[ "$file" == 'package.json' ]]; then
tag="v$version"
latest=true
notes=(--generate-notes)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

umm...--generate-notes starts at the previous GitHub Release in the repo. This loop creates @asyncapi/diff, @asyncapi/optimizer, and @asyncapi/bundler first, all on $GITHUB_SHA, and the CLI v release last... The CLI notes are therefore generated from the library tag on the same commit... so the CLI release body is empty..
the same thing happens on a later CLI-only release if the newest release in the repo is still a library tag...colud have a look at it once

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Let me have a look.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Made this explicit now. Passing the previous CLI tag through --notes-start-tag, so library tags won't affect the comparison. For the first release, we use its changelog entry. Checked the notes here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

But before also it was checking previous tags of that specific package so shouldn't have been a problem.

https://github.com/asyncapi-actions-test/cli/releases/tag/v90.0.4

Comment on lines 64 to 71
uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d # v1.9.0
id: release
with:
version: npm run bump:version
commit: "chore(release): release and bump versions of packages"
title: "chore(release): release and bump versions of packages"
publish: npm run publish:trusted
commit: 'chore(release): release and bump versions of packages'
title: 'chore(release): release and bump versions of packages'
createGithubReleases: false
setupGitUser: false
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

setupGitUser now defaults to true, and the old GIT_AUTHOR_* / GIT_COMMITTER_* values for asyncapi-bot were removed. In changesets/action v1.9.0, setupUser() passes the quotes as part of the value, so the commit author is stored as "github-actions[bot]" and does not link to the GitHub Actions bot.

also... can we restore the asyncapi-bot / [email protected] author and committer env vars

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Restored asyncapi-bot / [email protected] for both author and committer. Also set setupGitUser: false so Changesets doesn't override it. Verified both here in this commit.

if gh release view "$tag" --repo "$GITHUB_REPOSITORY" > /dev/null 2>&1; then
continue
fi
gh release create "$tag" --repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" --title "$tag" --latest="$latest" "${notes[@]}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

gh release create for @asyncapi/[email protected] fires release-announcements.yml. slack will post that library tag as an AsyncAPI CLI release. The Twitter job then runs on a tag that is not a semver (@asyncapi/[email protected]), so that job fails.

Docker, server API, and installers are filtered. Announcements are not...so can we add the same vX.Y.Z filter?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This would need to be fixed in .github. I will create a PR there.

@princerajpoot20 princerajpoot20 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

left a few comments

@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@princerajpoot20 princerajpoot20 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good. great work buddy!

@github-project-automation github-project-automation Bot moved this from In review to Backlog in CLI - Kanban Nov 2, 2026
@Shurtu-gal
Shurtu-gal merged commit cfe4a7c into asyncapi:master Nov 2, 2026
22 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in CLI - Kanban Nov 2, 2026
@Shurtu-gal
Shurtu-gal deleted the feat/release-workflow-hardening branch November 2, 2026 08:02
@github-actions github-actions Bot added the microgrant Participation in the Microgrant Program label Nov 2, 2026
@aeworxet

aeworxet commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@asyncapi/microgrant_team

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

Labels

microgrant Participation in the Microgrant Program

Projects

Status: Done
Status: Completed

Development

Successfully merging this pull request may close these issues.

Make the Changesets release workflow safer and easier to maintain

3 participants