Skip to content
Merged
Changes from all commits
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
39 changes: 29 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- run: python -m pip install build twine
- run: python -m build
- run: python -m twine check dist/*
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v5
with:
name: python-package-distributions
path: dist/
Expand All @@ -35,28 +35,47 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v5
with:
name: python-package-distributions
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
# Re-running a release (or re-pushing its tag) must not fail on files
# PyPI already has; PyPI never allows replacing them anyway.
skip-existing: true

release:
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: actions/download-artifact@v5
with:
name: python-package-distributions
path: dist/
- name: Create GitHub release
- name: Create or update the GitHub release from CHANGELOG.md
env:
GH_TOKEN: ${{ github.token }}
run: >-
gh release create "$GITHUB_REF_NAME" dist/*
--repo "$GITHUB_REPOSITORY"
--verify-tag
--generate-notes
--title "TaskSeam $GITHUB_REF_NAME"
run: |
version="${GITHUB_REF_NAME#v}"
awk -v heading="## $version" '
index($0, heading " ") == 1 || $0 == heading { found = 1; next }
found && /^## / { exit }
found { print }
' CHANGELOG.md > release-notes.md
if ! grep -q '[^[:space:]]' release-notes.md; then
echo "See [CHANGELOG.md](https://github.com/$GITHUB_REPOSITORY/blob/main/CHANGELOG.md)." > release-notes.md
fi
if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release edit "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" \
--title "TaskSeam $GITHUB_REF_NAME" --notes-file release-notes.md
gh release upload "$GITHUB_REF_NAME" dist/* --repo "$GITHUB_REPOSITORY" --clobber
else
gh release create "$GITHUB_REF_NAME" dist/* --repo "$GITHUB_REPOSITORY" --verify-tag \
--title "TaskSeam $GITHUB_REF_NAME" --notes-file release-notes.md
fi
Loading