Pypi #16
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: Build Python | |
on: | |
push: | |
release: | |
types: [published] | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Build | |
run: bash build.sh | |
- name: Publish Python package | |
if: github.event_name == 'release' | |
run: | | |
python -m pip install --upgrade pip | |
pip install twine | |
twine upload dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: dist | |
- name: Generate documentation | |
run: | | |
pip install pdoc3 | |
pip install -r requirements.txt | |
pdoc --html -o docs/ openagents | |
tar -czvf docs.tar.gz docs | |
- name: Upload Docs Artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: docs | |
path: docs | |
- name: Upload release asset | |
if: github.event_name == 'release' | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
dist/*.tar.gz | |
docs.tar.gz | |
- name: Deploy documentation to GitHub Pages | |
if: github.event_name == 'release' | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/openagents |