Skip to content

release

release #6

Workflow file for this run

name: release
on:
release:
types: [ published ]
jobs:
release:
runs-on: ubuntu-latest
env:
PYPI_PASSWD: ${{ secrets.PYPI_PASSWD }}
TEST_PYPI_PASSWD: ${{ secrets.TEST_PYPI_PASSWD }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Modify setup.py version
run: |
sed -i -E 's|version=\".*?\"|version="${{ github.event.release.tag_name }}"|g' setup.py
- name: Build
run: |
python setup.py sdist bdist_wheel
- name: Upload release assets
uses: AButler/[email protected]
with:
files: dist/*
repo-token: ${{ secrets.GITHUB_TOKEN }}
permissions: write-all
release-tag: ${{ github.event.release.tag_name }}
- name: Publish to test-pypi
if: env.TEST_PYPI_PASSWD != ''
run: |
twine upload dist/* --repository testpypi -u __token__ -p ${{ secrets.TEST_PYPI_PASSWD }} --non-interactive --disable-progress-bar -c "${{ github.event.release.body }}"
- name: Publish to pypi
if: "!github.event.release.prerelease && env.PYPI_PASSWD != ''"
run: |
twine upload dist/* --repository pypi -u __token__ -p ${{ secrets.PYPI_PASSWD }} --non-interactive --disable-progress-bar -c "${{ github.event.release.body }}"