Publish to PyPI #7
Workflow file for this run
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: Publish to PyPI | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Version to be published" | |
required: true | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
environment: pypi-publish | |
defaults: | |
run: | |
working-directory: dask-felleskomponenter | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get the current branch name | |
id: vars | |
run: echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install setuptools wheel twine build | |
- name: Configure Git | |
run: | | |
git config --local user.name "GitHub Actions" | |
git config --local user.email "[email protected]" | |
- name: Bump version in setup.py | |
run: | | |
sed -i "s/version=\"[^\"]*\"/version=\"${{ github.event.inputs.version }}\"/" setup.py | |
git add setup.py | |
git commit -m "Bump dask-felleskomponenter PyPI package version to ${{ github.event.inputs.version }}" | |
git push origin ${{ env.BRANCH_NAME }} | |
- name: Build the package | |
run: | | |
python3 -m build | |
- name: Publish to PyPI | |
run: | | |
python3 -m twine upload dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |