Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build a draft release and then publish once complete #432

Merged
merged 2 commits into from
Dec 9, 2024

Conversation

huonw
Copy link
Contributor

@huonw huonw commented Dec 3, 2024

Instead of publishing partial releases (even for a few minutes) as the matrix of builds adds their artefacts, create a draft release that we then publish in once the build has finished.

Background: the build process involves some set-up, then a matrix of building for different platforms, then some finalisation. This change is moving the "publish the release" from the matrix jobs to the finalisation job.

image

This has a few benefits:

  • Atomic publishing: a release is only published once it has artifacts for all platforms. Before this change, if a builder fails for one platform, we'll have published a "latest" release visible to get-pants.sh, and so running that on the broken platform will fail. (Example: Release CI fails to trigger CircleCI linux aarch64 build #430.)
  • Reduced duplicate work: rather than have each builder in the matrix compute changelogs etc., just do it once as part of the publishing. This is more conceptually helpful, than an optimisation, since it only takes a few seconds to prep the changelog.

@huonw

This comment was marked as resolved.

@huonw huonw force-pushed the huonw/draft-release branch from e2818c0 to 9e1534d Compare December 6, 2024 01:42
@huonw huonw marked this pull request as ready for review December 6, 2024 02:03
@huonw huonw force-pushed the huonw/draft-release branch from 9e1534d to 7c5ca6e Compare December 6, 2024 02:08
@huonw huonw force-pushed the huonw/draft-release branch from 7c5ca6e to 4516404 Compare December 6, 2024 02:10
@huonw huonw requested review from cburroughs and benjyw December 6, 2024 02:12

# Build up a draft release with the artifacts from each of these jobs:
- name: Create ${{ needs.determine-tag.outputs.release-tag }} Release
uses: softprops/action-gh-release@v1
Copy link
Contributor

Choose a reason for hiding this comment

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

We use softprops/action-gh-release@v2 below, why @v1 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ooos, merge skew: I started working on this before bumping the actions. Thanks

@@ -94,14 +94,37 @@ jobs:
'
cargo run -p package -- --dest-dir dist/ scie \
--scie-pants dist/scie-pants --tools-pex dist/tools.pex

# Build up a draft release with the artifacts from each of these jobs:
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm reading correctly, this is a step in a matrixed job, so how do we not create this draft release multiple times? Is this action idempotent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is idempotent.

As additional assurance it'll likely work as we hope: the old approach was doing the same thing of "creating" the release concurrently/multiple times, just not as a draft.

Copy link
Contributor

@benjyw benjyw left a comment

Choose a reason for hiding this comment

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

LGTM after updating to softprops/action-gh-release@v2

@huonw huonw merged commit e9f52bd into pantsbuild:main Dec 9, 2024
6 checks passed
@huonw
Copy link
Contributor Author

huonw commented Dec 9, 2024

I tagged a v0.12.3-beta.0 to test. It needs

The build was https://github.com/pantsbuild/scie-pants/actions/runs/12226797242

While that was running, there was a draft release: 🎉

image

... but then the publish and announce step created a whole new release: ❌

image

and the changelog is bad too.

See #439 for my attempted fixes

@huonw huonw deleted the huonw/draft-release branch December 9, 2024 02:02
huonw added a commit that referenced this pull request Dec 10, 2024
…og (#439)

As observed in
#432 (comment),
after #432, release CI has two problems:

- It creates two releases, one as a draft that the artifacts are
uploaded too, and then one that's published. I'm guessing this is
because the `name` key wasn't set on the draft uploads
- The release notes couldn't be created, because the repo and its code
(particularly `CHANGES.md`) wasn't available in the publishing step
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants