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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 27 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.

- 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

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.determine-tag.outputs.release-tag }}
draft: true
# placeholder body to help someone track down why a release is still in draft:
body: "Release job in progress: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
files: dist/scie-pants-*
fail_on_unmatched_files: true

publish-announce-release:
name: Publish and Announce Release
needs:
- determine-tag
- github-release
runs-on: ubuntu-22.04
steps:
# Now, do the human-facing prep on the release (changelog etc.), and publish it
- name: Prepare Changelog
id: prepare-changelog
uses: a-scie/actions/changelog@v1.5
with:
changelog-file: ${{ github.workspace }}/CHANGES.md
version: ${{ needs.determine-tag.outputs.release-version }}
setup-python: ${{ matrix.os == 'ubuntu-22.04' }}
- name: Create ${{ needs.determine-tag.outputs.release-tag }} Release
setup-python: true

- name: Publish ${{ needs.determine-tag.outputs.release-tag }} Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -111,16 +134,9 @@ jobs:
body_path: ${{ steps.prepare-changelog.outputs.changelog-file }}
draft: false
prerelease: ${{ needs.determine-tag.outputs.prerelease }}
files: dist/scie-pants-*
fail_on_unmatched_files: true
discussion_category_name: Announcements
announce-release:
name: Announce Release
needs:
- determine-tag
- github-release
runs-on: ubuntu-22.04
steps:

# Announce the release! Yay
- name: Post Release Announcement to Pants Slack `#announce`
if: ${{ needs.determine-tag.outputs.prerelease != 'true' }}
id: slack
Expand Down