Repository navigation
Add release workflow - #268
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
detect runs with a read-only token, which can't see draft releases, so resolve-pending-release now reports the newest CHANGELOG.md version as pending until it has a published release. A real dispatch on a version that is already released fails; the publish job's draft check confirms the draft after approval.
The assets go onto the draft release, which users can't see yet, before the registry publish, so the un-draft is the only step left after it. --clobber lets a re-run of a failed job overwrite assets that were already attached instead of failing with "asset already exists".
github.ref_name is the short name, so a manual run started from a tag named like the default branch passed the check and would build that tag's commit. Comparing github.ref with refs/heads/<default branch> accepts only the branch.
A dry run continues whether or not the top CHANGELOG.md version is released, so it passed even when detection was wrong. Decide now logs pending and dry_run, and a dry run on an already released version gets a warning that it didn't exercise detection.
|
|
||
| # The draft disappears once a release is published, so this also stops a second publish. | ||
| - name: Check GitHub release | ||
| uses: railsware/github-actions/check-sdk-github-release@master |
There was a problem hiding this comment.
[could] This job's token can push packages and publish releases, yet Check GitHub release here and Publish GitHub release below run whatever sits on master of railsware/github-actions at run time, so a later change to that branch ships through this job without any review in this repo. The actions/* steps in this file are already pinned to commit SHAs – pinning these two the same way (SHA plus a version comment) would close that gap.
| env: | ||
| NUGET_TOKEN: ${{ github.token }} | ||
| run: | | ||
| dotnet nuget push "dist/*.nupkg" \ |
There was a problem hiding this comment.
[could] If the Mailtrap.Abstractions push fails – for example because that package hasn't been given Actions access yet – Mailtrap can already be on the feed at the new version, and nobody can install it since the Mailtrap.Abstractions version it depends on isn't there (a plain dotnet add package Mailtrap picks it up). The glob order comes from the runner's directory listing rather than the dependency order, and dotnet nuget push stops at the first failure. Pushing dist/Mailtrap.Abstractions.*.nupkg in its own command before Mailtrap avoids leaving the feed half-published.
| @@ -0,0 +1,154 @@ | |||
| # Publishes the release drafted by draft-release.yml. Runs when the release PR lands on main | |||
| # (or manually, as a fallback / dry run): detects the pending draft from CHANGELOG.md, tests and | |||
There was a problem hiding this comment.
[nitpick] This doesn't detect the pending draft: detect can't see drafts, so it treats the top CHANGELOG.md version as pending until it has a published release, and the draft is only checked after approval. The PR description ("runs only when a draft release matches the top CHANGELOG.md version") has drifted the same way – a CHANGELOG edit made while the top version is still unreleased, say after a rejected approval, builds again and asks for another approval. Worth rewording both.
Motivation
Releases are drafted from this repo but published from a separate central workflow with a personal access token. This moves publishing here: merging the release PR pushes the packages and publishes the drafted release once a maintainer approves it, using the workflow's own token.
Changes
Releaseworkflow that runs whenCHANGELOG.mdchanges onmain, with a manual run and a dry run as a fallbackCHANGELOG.mdversion, so ordinary changelog edits are skippedMailtrapandMailtrap.Abstractionswithout any publishing rights. MinVer gets theCHANGELOG.mdversion throughMinVerVersionOverride, since the tag only exists once the release is publishedreleaseenvironment, then pushes the packages to the org's GitHub Packages feed with the workflow token (packages: write), attaches the.nupkgand.snupkgfiles to the GitHub Release, and pins the draft to the merged commit before publishing itBefore merging
MailtrapandMailtrap.Abstractionsgrant this repo the Write role under package settings, "Manage Actions access"How to test
Releaseworkflow manually withdry_runchecked:detectandbuildpass, thepackagesartifact holds both.nupkgand.snupkgpairs,Publishis skippedreleasedeployment: both packages are on the feed at the new version, and the release has the packages attached and its tag on the merge commit