Skip to content

Commit e9f52bd

Browse files
authored
Build a draft release and then publish once complete (#432)
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](https://github.com/user-attachments/assets/ec8d2161-6fe3-471c-bdc7-aa1f887f1cf4) 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: #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.
1 parent 8c6f8fd commit e9f52bd

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,37 @@ jobs:
9494
'
9595
cargo run -p package -- --dest-dir dist/ scie \
9696
--scie-pants dist/scie-pants --tools-pex dist/tools.pex
97+
98+
# Build up a draft release with the artifacts from each of these jobs:
99+
- name: Create ${{ needs.determine-tag.outputs.release-tag }} Release
100+
uses: softprops/action-gh-release@v2
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
with:
104+
tag_name: ${{ needs.determine-tag.outputs.release-tag }}
105+
draft: true
106+
# placeholder body to help someone track down why a release is still in draft:
107+
body: "Release job in progress: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
108+
files: dist/scie-pants-*
109+
fail_on_unmatched_files: true
110+
111+
publish-announce-release:
112+
name: Publish and Announce Release
113+
needs:
114+
- determine-tag
115+
- github-release
116+
runs-on: ubuntu-22.04
117+
steps:
118+
# Now, do the human-facing prep on the release (changelog etc.), and publish it
97119
- name: Prepare Changelog
98120
id: prepare-changelog
99121
uses: a-scie/actions/[email protected]
100122
with:
101123
changelog-file: ${{ github.workspace }}/CHANGES.md
102124
version: ${{ needs.determine-tag.outputs.release-version }}
103-
setup-python: ${{ matrix.os == 'ubuntu-22.04' }}
104-
- name: Create ${{ needs.determine-tag.outputs.release-tag }} Release
125+
setup-python: true
126+
127+
- name: Publish ${{ needs.determine-tag.outputs.release-tag }} Release
105128
uses: softprops/action-gh-release@v2
106129
env:
107130
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -111,16 +134,9 @@ jobs:
111134
body_path: ${{ steps.prepare-changelog.outputs.changelog-file }}
112135
draft: false
113136
prerelease: ${{ needs.determine-tag.outputs.prerelease }}
114-
files: dist/scie-pants-*
115-
fail_on_unmatched_files: true
116137
discussion_category_name: Announcements
117-
announce-release:
118-
name: Announce Release
119-
needs:
120-
- determine-tag
121-
- github-release
122-
runs-on: ubuntu-22.04
123-
steps:
138+
139+
# Announce the release! Yay
124140
- name: Post Release Announcement to Pants Slack `#announce`
125141
if: ${{ needs.determine-tag.outputs.prerelease != 'true' }}
126142
id: slack

0 commit comments

Comments
 (0)