Repository navigation
feat: harden workspace releases with Changesets and OIDC - #2336
Conversation
🦋 Changeset detectedLatest commit: e6a0c6e The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
|
Found out Successful run: https://github.com/asyncapi-actions-test/cli/actions/runs/40628802285 Tested diff major ( |
|
I had made the changes to |
princerajpoot20
left a comment
There was a problem hiding this comment.
I’ll review this over the coming weekend. At first glance, one concern I have is...
| 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 |
There was a problem hiding this comment.
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”
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| tag="$name@$version" | ||
| latest=false | ||
| notes=(--notes "Release $tag.") | ||
| if [[ "$file" == 'package.json' ]]; then | ||
| tag="v$version" | ||
| latest=true | ||
| notes=(--generate-notes) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Let me have a look.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
But before also it was checking previous tags of that specific package so shouldn't have been a problem.
| 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 }} |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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[@]}" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
This would need to be fixed in .github. I will create a PR there.
Signed-off-by: Shurtu-gal <[email protected]>
|
princerajpoot20
left a comment
There was a problem hiding this comment.
looks good. great work buddy!
|
@asyncapi/microgrant_team |



Description
asyncapi-botcommit identity.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