Skip to content
36 changes: 27 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand All @@ -99,6 +99,23 @@ jobs:
with:
packages-dir: dist/

draft-release:

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member Author

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

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 ]
Expand All @@ -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
Expand All @@ -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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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 svenstaro/upload-release-action) for uploading nightly reduced files here: https://github.com/scipp/ess/blob/main/.github/workflows/nightly.yml#L90

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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:
Expand Down Expand Up @@ -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.
9 changes: 2 additions & 7 deletions tools/collect-release-notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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')}",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you explain why this is now gone?

@YooSunYoung YooSunYoung Jun 30, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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:
Expand Down