-
Notifications
You must be signed in to change notification settings - Fork 35
42 lines (33 loc) · 1.36 KB
/
pypi-package-upload-testpypi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Upload Python Package to TEST PYPI
on:
workflow_dispatch:
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel build twine
- name: Get current version from pyproject.toml
id: get_version
run: echo "::set-output name=version::$(grep -oP '(?<=version = ")[^"]*' pyproject.toml)"
- name: Increment version
id: increment_version
run: echo "::set-output name=version::$(python -c "version='${{ steps.get_version.outputs.version }}'.split('.'); version[-1] = str(int(version[-1]) + 1); print('.'.join(version))")"
- name: Update version in pyproject.toml
run: sed -i "s/version = \".*\"/version = \"${{ steps.increment_version.outputs.version }}\"/" pyproject.toml
- name: Build and upload to Test PyPI (master branch)
# if: github.ref == 'refs/heads/master'
run: |
python -m build
twine upload --repository-url https://test.pypi.org/legacy/ --username __token__ --password ${{ secrets.TEST_PYPI_TOKEN }} dist/*