Repository navigation
chore: show release version before publish approval - #10648
Conversation
Move version calculation into a preview job that runs before the publish job's release environment approval, and show the version and dist-tag on the run page so approvers can check them first. The preview job is also the whole of a dry run, and it runs on forks so the workflow can be tested there. The publish job reuses the preview's version command, so the version shown is worked out the same way as the one that is published.
| # Works out the version and dist-tag without committing or publishing, so the | ||
| # person approving the publish job can check them first. This is also the | ||
| # whole of a dry run. | ||
| preview: |
There was a problem hiding this comment.
the new job to show the preview
| environment: release | ||
| permissions: | ||
| contents: read | ||
| outputs: |
There was a problem hiding this comment.
passing the dist tag and version command to publish
| if: ${{ !inputs.skip_versioning }} | ||
| # The publish job runs this exact command, so the version shown here is | ||
| # the version that gets published. | ||
| - name: Build version command |
There was a problem hiding this comment.
an example of produced command - npx lerna version --conventional-prerelease --preid beta --ignore-scripts --force-publish --conventional-commits --yes
Record the commit the preview ran on and check it again in the publish job, so the version shown before approval is the one released. Also drop step-level dry_run checks, since the publish job no longer runs on dry runs.
| echo "version_command=${VERSION_COMMAND}" >> "$GITHUB_OUTPUT" | ||
| echo "${VERSION_COMMAND}" | ||
|
|
||
| - name: Preview version |
There was a problem hiding this comment.
running the command to get the version without pushing anything
| needs: preview | ||
| runs-on: ubuntu-latest | ||
| # Don't try to publish from a fork of RaspberryPiFoundation/blockly. | ||
| if: ${{ !inputs.dry_run && github.repository_owner == 'RaspberryPiFoundation' }} |
There was a problem hiding this comment.
Not running publish on dry run, so we can remove the checks of !inputs.dry_run from other steps within this job
| PREVIEW_SHA: ${{ needs.preview.outputs.sha }} | ||
| run: | | ||
| HEAD_SHA=$(git rev-parse HEAD) | ||
| if [ "${HEAD_SHA}" != "${PREVIEW_SHA}" ]; then |
There was a problem hiding this comment.
check to ensure that nothing else was merged while waiting for publish approval. basically the preview version and published version should match
lizschwab
left a comment
There was a problem hiding this comment.
Overall this looks fine. I tested out the bash scripts locally with various inputs and everything seems to be working correctly. I'm going to approve this right now and then tomorrow I will run a test beta publish to make sure it's working correctly. We won't test the "latest" dist tag scenario until we're ready for a true release.
Changed the lerna loglevel from silly to warn
The basics
The details
Resolves
Fixes #10426
Proposed Changes
Adds a
previewjob to the publish workflow that runs betweenciandpublish, before thereleaseenvironment approval.previewworks out the dist-tag and builds thelerna versioncommand (same logic as before, moved out ofpublish), nothing is committed, tagged or pushed.publishis waiting for approval.Reason for Changes
Before #10231, a separate
versionjob ran before the gatedpublishjob and printed the version, so approvers could check it before approving. #10231 moved versioning into the gated job (lerna versions, commits and tags in one command), so the version only appeared after approval. For example, in the 13.4.0 release run the version first appears a few minutes afterpublishwas approved, compared with the 13.2.1 release run where it was printed before.This keeps #10231's goal of using a single version command for dry runs and real releases, and brings back the check before approval.
Test Coverage
Tested on my fork with a dry run from a non-default branch: run 41325662213.
cipassed,previewshowedblockly 13.4.0 => 13.4.1-beta.0on dist-tagbeta, andpublishwas skipped.Documentation
None needed.