-
Notifications
You must be signed in to change notification settings - Fork 2
[CI] Add draft release step to GitHub Actions workflow #644
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
Changes from all commits
28d7fca
f0a45ab
d978cb5
49ef8aa
113118c
34e910d
b93b009
d3a6d05
09ba1a2
6a8a540
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,7 +84,7 @@ jobs: | |
|
|
||
| publish: | ||
| name: Publish to PyPI | ||
| needs: [ determine-package, build ] | ||
| needs: build | ||
| runs-on: ubuntu-24.04 | ||
| environment: release | ||
| if: ${{ startsWith(github.ref, 'refs/tags/') && github.event_name != 'workflow_dispatch' }} | ||
|
|
@@ -99,6 +99,23 @@ jobs: | |
| with: | ||
| packages-dir: dist/ | ||
|
|
||
| draft-release: | ||
| name: Draft a release or/and check the release | ||
| needs: [ determine-package, publish ] | ||
| runs-on: ubuntu-slim | ||
| permissions: | ||
| contents: write | ||
| env: | ||
| TAG: ${{ needs.determine-package.outputs.package }}/${{ needs.determine-package.outputs.version }} | ||
| steps: | ||
| - name: Draft a release. | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: gh release create ${TAG} --draft --title ${TAG} # Default title is not always the tag name. | ||
| continue-on-error: true # Release create can fail if there is an existing release. | ||
| - name: Check the release. | ||
| run: gh release view ${TAG} # This command should not fail if the release already exists or was created by the previous step. | ||
|
|
||
| docs: | ||
| name: Build and publish docs | ||
| needs: [ determine-package, publish ] | ||
|
|
@@ -112,7 +129,7 @@ jobs: | |
|
|
||
| assets: | ||
| name: Upload docs | ||
| needs: [ docs, determine-package ] | ||
| needs: [ docs, determine-package, draft-release ] | ||
| runs-on: ubuntu-24.04 | ||
| permissions: | ||
| contents: write | ||
|
|
@@ -128,14 +145,15 @@ jobs: | |
| mv docs_html documentation-${PACKAGE}-${VERSION} | ||
| zip -r documentation-${PACKAGE}-${VERSION}.zip documentation-${PACKAGE}-${VERSION} | ||
| - name: Upload release assets | ||
| uses: svenstaro/upload-release-action@v2 | ||
| with: | ||
| file: ./documentation-${{ needs.determine-package.outputs.package }}-${{ needs.determine-package.outputs.version }}.zip | ||
| overwrite: false | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| ASSET-FILE-PATH: ./documentation-${{ needs.determine-package.outputs.package }}-${{ needs.determine-package.outputs.version }}.zip | ||
| TAG: ${{ needs.determine-package.outputs.package }}/${{ needs.determine-package.outputs.version }} | ||
| run: gh release upload ${TAG} ${ASSET-FILE-PATH} --clobber # Overwrite existing assets of the same name. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated to these changes: can we use the same (get rid of the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so ...? |
||
|
|
||
| notes: | ||
| name: Update notes | ||
| needs: [ determine-package, publish ] | ||
| needs: [ determine-package, draft-release ] | ||
| runs-on: ubuntu-slim | ||
| if: ${{ always() && needs.determine-package.outputs.lastversion }} | ||
| permissions: | ||
|
|
@@ -180,8 +198,8 @@ jobs: | |
| run: cat .ess_release_cache/${PACKAGE}-${VERSION}-${PACKAGE}-${LASTVERSION}-releasenote.md >> new-release-note.md | ||
| - name: Check the generated note | ||
| run: cat new-release-note.md | ||
| - name: Upload release note | ||
| - name: Upload release note and publish the release | ||
| if: ${{ github.event_name != 'workflow_dispatch' }} | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: gh release edit ${PACKAGE}/${VERSION} --notes-file "new-release-note.md" | ||
| run: gh release edit ${PACKAGE}/${VERSION} --notes-file "new-release-note.md" --draft=false # Publish the release with the new note. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,7 +39,7 @@ class MergeLog(BaseModel): | |
|
|
||
| def __str__(self) -> str: | ||
| authors = ", ".join([f"@{author.login}" for author in self.authors]) | ||
| return f"{self.pr.title} by {authors} in {self.pr.url}" | ||
| return f"{self.pr.title} by {authors} in https://github.com/scipp/ess/pull/{self.pr.number}" | ||
|
|
||
|
|
||
| def get_commits_file(cur_tag: str, compare_tag: str) -> pathlib.Path: | ||
|
|
@@ -107,12 +107,7 @@ def has_label(label: str, pr: PRDescription) -> bool: | |
| else: | ||
| maybe_relevant_logs.append(merge_log) | ||
|
|
||
| release_note = [ | ||
| "## What's Changed", | ||
| '', | ||
| f"### {package_name.replace('ess', 'ESS')}", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain why this is now gone?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's already included in the release title so it was unnecessarily verbose. Or we can integrate that into the other section title..? Like: What's Changed in ESSreduce/26.6.2 |
||
| '', | ||
| ] | ||
| release_note = ["## What's Changed"] | ||
| release_note.extend([f"* {relevant_log}" for relevant_log in relevant_logs]) | ||
|
|
||
| if args.maybe_relevant: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step should be green even if creating the release fails.
For example, if release was created via the web interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the step success optional and then added a checking step