Skip to content

Commit

Permalink
update gh action for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
timvink authored Apr 16, 2024
1 parent c7c31f1 commit ced5d88
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
name: Upload Python Package

on:
workflow_dispatch:
release:
types: [created]


jobs:
deploy:
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
contents: write
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up Python
uses: actions/setup-python@master
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Make sure unit tests succeed
run: |
git config --global user.name "Github Action"
git config --global user.email "[email protected]"
pip install -r tests/test_requirements.txt
pip install -e .
pip install .
pytest
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
- name: Build
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
# See https://docs.pypi.org/trusted-publishers/using-a-publisher/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit ced5d88

Please sign in to comment.