Add main function to __main__.py for proper entry point #8
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: Release | |
on: | |
push: | |
tags: | |
- '*.*.*' | |
jobs: | |
build: | |
name: Build distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install build dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install hatchling | |
- name: Build a binary wheel and a source tarball | |
run: python -m hatchling build | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
publish-to-pypi: | |
name: Publish to PyPI | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
github-release: | |
name: Make release | |
needs: | |
- publish-to-pypi | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # IMPORTANT: mandatory for making GitHub Releases | |
id-token: write # IMPORTANT: mandatory for sigstore | |
outputs: | |
gitmuse_version: ${{ steps.get_version.outputs.version }} | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Get GitMuse version | |
id: get_version | |
run: | | |
VERSION=$(find dist -type f -name '*.tar.gz' | grep -oP '\d+.\d+.\d+') | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "Release version $VERSION" | |
- name: Sign the dists with Sigstore | |
uses: sigstore/[email protected] | |
with: | |
inputs: >- | |
./dist/*.tar.gz | |
./dist/*.whl | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: >- | |
gh release create | |
"${{ steps.get_version.outputs.version }}" | |
--repo '${{ github.repository }}' | |
--notes "Release ${{ steps.get_version.outputs.version }}" | |
dist/* | |
- name: Upload artifact signatures to GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: >- | |
gh release upload | |
"${{ steps.get_version.outputs.version }}" dist/** | |
--repo '${{ github.repository }}' | |
verify-installation: | |
name: Verify Package Installation | |
needs: | |
- github-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Wait for PyPI to process the upload | |
run: | | |
echo "Waiting for PyPI to process the upload..." | |
sleep 300 | |
- name: Install and verify package | |
run: | | |
python -m venv test_env | |
source test_env/bin/activate | |
pip install --upgrade pip | |
pip install gitmuse==${{ needs.github-release.outputs.gitmuse_version }} --no-cache-dir --verbose | |
gitmuse --version | |
- name: Debug PyPI package info | |
if: failure() | |
run: | | |
pip install yolk3k | |
yolk -V gitmuse | |
yolk -F gitmuse | |
pip install gitmuse==${{ needs.github-release.outputs.gitmuse_version }} --no-cache-dir --verbose |