Merge pull request #239 from awanlin/topic/fix-publish #51
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: TechDocs PyPI Publish main branch | |
on: | |
push: | |
branches: [main] | |
paths: | |
- ".github/workflows/pypi-publish.yml" | |
- "setup.py" | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.13] | |
steps: | |
# Publish mkdocs-techdocs-core to PyPI | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@master | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install pip, setuptools, and wheel | |
run: python -m pip install --upgrade pip setuptools wheel | |
- name: Build Python distribution | |
working-directory: . | |
run: | | |
rm -rf dist | |
python setup.py bdist_wheel sdist --formats tar | |
pushd dist >/dev/null || exit | |
distrib=$(ls *.tar); distrib=${distrib/.tar/} | |
mkdir -p ${distrib} | |
cp ../requirements.txt ${distrib} | |
tar rvf ${distrib}.tar ${distrib}/requirements.txt && gzip ${distrib}.tar | |
rm -fr ${distrib} | |
popd >/dev/null || exit | |
- name: Publish a Python distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@v1.12.2 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_KEY }} | |
packages_dir: ./dist |