1
+ name : Update Version and Publish to Test PyPI
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ new_version :
7
+ description : ' New version'
8
+ required : true
9
+
10
+ jobs :
11
+ update-version-and-create-tag :
12
+ runs-on : ubuntu-latest
13
+
14
+ steps :
15
+ - name : Checkout code
16
+ uses : actions/checkout@v2
17
+
18
+ - name : Set up Python 3.10
19
+ uses : actions/setup-python@v2
20
+ with :
21
+ python-version : ' 3.10'
22
+
23
+ - name : Update version in toml file
24
+ run : |
25
+ sed -i 's/version\s*=\s*".*"/version = "${{ github.event.inputs.new_version }}"/' pyproject.toml
26
+
27
+ - name : Commit changes
28
+ run : |
29
+ git config --local user.email "${{ github.actor }}@users.noreply.github.com"
30
+ git config --local user.name "${{ github.actor }}"
31
+ git commit -m "Update version in toml file" pyproject.toml
32
+
33
+ - name : Push changes
34
+ uses : ad-m/github-push-action@master
35
+ with :
36
+ github_token : ${{ secrets.GITHUB_TOKEN }}
37
+ branch : ${{ github.ref }}
38
+
39
+ - name : Create tag
40
+ run : |
41
+ git tag "test-${{ github.event.inputs.new_version }}"
42
+
43
+ - name : Push tag
44
+ run : |
45
+ git push origin "test-${{ github.event.inputs.new_version }}"
46
+
47
+ - name : Install dependencies
48
+ run : |
49
+ python -m pip install --upgrade pip
50
+ pip install poetry
51
+
52
+ - name : Configure Poetry
53
+ run : |
54
+ poetry config repositories.pyoptimus https://test.pypi.org/legacy/
55
+ poetry config http-basic.pyoptimus ${{ secrets.TEST_PYPI_USERNAME }} ${{ secrets.TEST_PYPI_PASSWORD }}
56
+
57
+ - name : Build and publish package
58
+ run : |
59
+ poetry build
60
+ poetry publish -r pyoptimus
61
+ env :
62
+ TEST_PYPI_USERNAME : ${{ secrets.TEST_PYPI_USERNAME }}
63
+ TEST_PYPI_PASSWORD : ${{ secrets.TEST_PYPI_PASSWORD }}
0 commit comments