Publish #37
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
tags: | |
- v* | |
workflow_dispatch: # allows you to trigger manually | |
permissions: | |
contents: write | |
attestations: write | |
id-token: write | |
jobs: | |
release-notes: | |
name: Create Release Notes | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate Changelog | |
run: |- | |
echo "Release Notes" > ${{ github.workflow }}-CHANGELOG.rst | |
echo "-------------" >> ${{ github.workflow }}-CHANGELOG.rst | |
PAT="^---" | |
L1=$(grep -n $PAT HISTORY.rst | sed -n 1p | cut -d ":" -f 1) | |
L2=$(grep -n $PAT HISTORY.rst | sed -n 2p | cut -d ":" -f 1) | |
awk "NR > $L1 && NR < $L2 - 1" HISTORY.rst >> ${{ github.workflow }}-CHANGELOG.rst | |
- name: Convert rst to md | |
uses: docker://pandoc/core | |
with: | |
args: >- | |
${{ github.workflow }}-CHANGELOG.rst | |
--wrap=none | |
-t markdown | |
-o ${{ github.workflow }}-CHANGELOG.md | |
- name: Remove extra spaces | |
run: |- | |
sed -i 's/- /- /g' ${{ github.workflow }}-CHANGELOG.md | |
- name: Github Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: ${{ github.workflow }}-CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-package: | |
name: Build and Inspect Python Package | |
runs-on: ubuntu-latest | |
needs: release-notes | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: hynek/build-and-inspect-python-package@v2 | |
with: | |
attest-build-provenance-github: true | |
release-pypi: | |
name: Publish to PyPI | |
runs-on: ubuntu-latest | |
needs: build-package | |
steps: | |
- name: Download packages built by build-and-inspect-python-package | |
uses: actions/download-artifact@v4 | |
with: | |
name: Packages | |
path: dist | |
- name: Generate artifact attestation for sdist and wheel | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: dist | |
- name: Upload package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |