.github/workflows/publish.yml #6
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
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
required: true | |
jobs: | |
bump-version-and-publish: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.inputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Bump version | |
run: | | |
sed -i "/VERSION =/c\VERSION = '${{ github.event.inputs.version }}'" setup.py | |
git diff | |
- uses: EndBug/add-and-commit@v9 | |
with: | |
add: setup.py | |
tag: -a "${{ github.event.inputs.version }}" -m "Version ${{ github.event.inputs.version }}" | |
- uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.version }} | |
release_name: Release ${{ github.event.inputs.version }} | |
- uses: actions/setup-python@v3 | |
with: | |
python-version: '3.9' | |
- run: python --version | |
- run: python -m pip install -U pip | |
- run: python -m pip install -U build | |
- run: python -m build | |
- run: ls dist | |
- run: python -m pip install -U twine | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |