Skip to content

Switched to python-publish GitHub action #4

Switched to python-publish GitHub action

Switched to python-publish GitHub action #4

Workflow file for this run

# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package
on:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine sphinx sphinx_rtd_theme
- name: Generate documentation with Sphinx
run: |
sphinx-apidoc -o docs src/waltlabtools
sphinx-build -b html docs docs/_build
- name: Build package
run: python -m build
- name: Build wheels
run: python -m build --wheel
- name: Check built distributions
run: twine check dist/*
- name: Upload to PyPI
if: startsWith(github.ref, 'refs/tags/')
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: twine upload dist/*
# - name: Upload to Anaconda
# if: startsWith(github.ref, 'refs/tags/')
# env:
# ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
# run: |
# anaconda login --username tylerdougan --password $ANACONDA_API_TOKEN
# anaconda upload dist/*.whl
release:
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
body: |
Release notes for version ${{ github.ref }}
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/
asset_name: $(basename $dist/*)
asset_content_type: application/zip