|
1 |
| -name: Publish to PyPI |
2 |
| - |
| 1 | +name: Publish to Pypi - Fairlens_pe |
3 | 2 | on:
|
4 |
| - release: |
5 |
| - types: [published] |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + version: |
| 6 | + description: 'Version to upload to pypi' |
| 7 | + required: true |
| 8 | + pypi_repo: |
| 9 | + description: 'Repo to upload to (testpypi or pypi)' |
| 10 | + default: 'testpypi' |
| 11 | + required: true |
6 | 12 |
|
7 | 13 | jobs:
|
8 |
| - build-and-publish: |
| 14 | + publish: |
9 | 15 | runs-on: ubuntu-latest
|
10 | 16 | steps:
|
11 |
| - - name: Checkout tag |
12 |
| - uses: actions/checkout@v2 |
13 |
| - with: |
14 |
| - fetch-depth: 0 |
15 |
| - ref: ${{ github.event.release.tag_name }} |
16 |
| - |
17 |
| - - name: Set up Python 3.11 |
18 |
| - uses: actions/setup-python@v1 |
19 |
| - with: |
20 |
| - python-version: 3.11 |
21 |
| - |
22 |
| - - name: Install pypa/build |
23 |
| - run: python -m pip install build --user |
24 |
| - |
25 |
| - - name: Build wheel and source dist |
26 |
| - run: python -m build --sdist --wheel --outdir dist/ . |
27 |
| - |
28 |
| - - name: Publish to PyPI |
29 |
| - uses: pypa/gh-action-pypi-publish@release/v1 |
30 |
| - with: |
31 |
| - user: __token__ |
32 |
| - password: ${{ secrets.PYPI_API_TOKEN }} |
| 17 | + - uses: actions/checkout@v3 |
| 18 | + - uses: actions/setup-python@v3 |
| 19 | + with: |
| 20 | + python-version: '3.11' |
| 21 | + - name: Install dependencies |
| 22 | + run: | |
| 23 | + python -m pip install --upgrade pip |
| 24 | + pip install wheel |
| 25 | + - name: Update version.txt |
| 26 | + run: echo "${{ github.event.inputs.version }}" > version.txt |
| 27 | + - name: Build package |
| 28 | + run: python setup.py sdist bdist_wheel |
| 29 | + env: |
| 30 | + VERSION: ${{ github.event.inputs.version }} |
| 31 | + - name: Publish package to TestPyPI |
| 32 | + |
| 33 | + with: |
| 34 | + user: __token__ |
| 35 | + password: ${{ secrets.TEST_PYPI_TOKEN }} |
| 36 | + repository_url: https://test.pypi.org/legacy/ |
| 37 | + if: ${{ github.event.inputs.pypi_repo == 'testpypi' }} |
| 38 | + - name: Publish package to PyPI |
| 39 | + |
| 40 | + with: |
| 41 | + user: __token__ |
| 42 | + password: ${{ secrets.PYPI_TOKEN }} |
| 43 | + if: ${{ github.event.inputs.pypi_repo == 'pypi' }} |
0 commit comments