Skip to content
Merged
Show file tree
Hide file tree
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
77 changes: 73 additions & 4 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ permissions:
contents: read

jobs:
deploy:
build-artifact:
name: Build package
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand All @@ -31,6 +30,76 @@ jobs:
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
run: |
python -m build
echo ""
echo "Generated files:"
ls -lh dist/
- uses: actions/upload-artifact@v3
with:
name: releases
path: dist
test-built-dist:
name: Test package
needs: build-artifact
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: actions/download-artifact@v3
with:
name: releases
path: dist
- name: List contents of built dist
run: |
ls -ltrh
ls -ltrh dist
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# TODO: Set up TEST_PYPI_API_TOKEN secret in GitHub Actions settings
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
verbose: true
skip_existing: true
- name: Check pypi packages
id: check_pkg
run: |
# Install local wheel to get the version number
echo "=== Testing wheel file ==="
pip install dist/autora_doc*.whl
latest_version="$(python -c 'from autora import doc; print(doc.__version__)')";export latest_version
echo "latest_version=$latest_version" >> $GITHUB_OUTPUT
echo "=== Got version $latest_version from local wheel install ==="
python -m pip uninstall --yes autora-doc
sleep 5

python -m pip install --upgrade pip
echo "=== Testing Test PyPi installation ==="
# Install wheel to get dependencies and check import
python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade --pre autora-doc==$latest_version
echo "=== Done testing Test PyPi file ==="
echo "=== Testing source tar file ==="
# Install tar gz and check import
python -m pip uninstall --yes autora-doc
python -m pip install --extra-index-url https://test.pypi.org/simple --upgrade --pre --no-binary=autora-doc autora-doc==$latest_version
python -c "from autora import doc; print(doc.__version__)"
echo "=== Done testing source tar file ==="
outputs:
package-version: ${{steps.check_pkg.outputs.latest_version}}
publish:
name: Publish distribution 📦 to PyPI
needs: test-built-dist
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
with:
name: releases
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 1 addition & 0 deletions src/autora/doc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._version import __version__
Loading