| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| versions: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release-version: ${{ steps.release-version.outputs.release_version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get release version | |
| id: release-version | |
| run: | | |
| VERSION="$(yq -p toml -o toml -r '.project.version' pyproject.toml)" | |
| echo "release_version=${VERSION}" >> "${GITHUB_OUTPUT}" | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - versions | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v10.3.2 | |
| - name: Install the world | |
| run: | | |
| uv python install | |
| uv sync | |
| - name: Build Package Distributions | |
| run: uv build | |
| - name: Store Package Distributions | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: package-distributions | |
| path: dist/ | |
| - name: Build Man Page | |
| run: uv run sphinx-build -M man docs _build | |
| - name: Store Man Page | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: man-page | |
| path: _build/man | |
| - name: Build Release Notes | |
| # thanks to https://gist.github.com/Integralist/57accaf446cf3e7974cd01d57158532c | |
| run: mkdir notes && awk '/^##/ {block++} {if (block == 1) { print }}' CHANGELOG.md > notes/RELEASE.md | |
| - name: Store Release Notes | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-notes | |
| path: notes | |
| pypi-release: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/pypi | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download distributions | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: package-distributions | |
| path: dist/ | |
| - name: Publish release to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| github-release: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - versions | |
| - build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download distributions | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: package-distributions | |
| path: dist/ | |
| - name: Download man page | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: man-page | |
| path: man | |
| - name: Download release notes | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: release-notes | |
| path: notes | |
| - name: Create a GitHub release | |
| env: | |
| GITHUB_TOKEN: ${{ github.TOKEN }} | |
| shell: bash | |
| run: | | |
| gh release create 'v${{ needs.versions.outputs.release-version }}' --title 'Release v${{ needs.versions.outputs.release-version }}' --notes "$(cat notes/RELEASE.md)" dist/* man/pyee.1 |