|
12 | 12 | default: false
|
13 | 13 | type: boolean
|
14 | 14 |
|
15 |
| -permissions: |
16 |
| - contents: write |
17 |
| - |
18 | 15 | jobs:
|
19 |
| - publish: |
| 16 | + bump: # This job is used to bump the version and create a release |
20 | 17 | runs-on: ubuntu-latest
|
21 | 18 | env:
|
22 | 19 | VERSION: ${{ inputs.VERSION }}
|
23 | 20 | GH_TOKEN: ${{ github.token }}
|
24 | 21 | SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
| 22 | + permissions: |
| 23 | + contents: write |
25 | 24 | steps:
|
26 | 25 | - name: set up Python
|
27 | 26 | uses: actions/setup-python@v4
|
|
31 | 30 | - name: install dependencies
|
32 | 31 | run: |
|
33 | 32 | pip install --upgrade pip
|
34 |
| - pip install build twine hatch |
| 33 | + pip install build hatch |
35 | 34 |
|
36 | 35 | - name: configure git with the bot credentials
|
37 | 36 | run: |
|
@@ -76,23 +75,54 @@ jobs:
|
76 | 75 | --title $VERSION $PRERELEASE_FLAG
|
77 | 76 | working-directory: ./nextmv-py
|
78 | 77 |
|
79 |
| - - name: build binary wheel and source tarball |
80 |
| - env: |
81 |
| - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
82 |
| - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
| 78 | + - name: ensure passing build |
83 | 79 | run: python -m build
|
84 | 80 | working-directory: ./nextmv-py
|
85 | 81 |
|
86 |
| - - name: publish to TestPyPI |
87 |
| - env: |
88 |
| - TWINE_USERNAME: ${{ secrets.TESTPYPI_USERNAME }} |
89 |
| - TWINE_PASSWORD: ${{ secrets.TESTPYPI_PASSWORD }} |
90 |
| - run: twine upload --repository testpypi dist/* |
91 |
| - working-directory: ./nextmv-py |
| 82 | + publish: # This job is used to publish the release to PyPI/TestPyPI |
| 83 | + runs-on: ubuntu-latest |
| 84 | + needs: bump |
| 85 | + strategy: |
| 86 | + matrix: |
| 87 | + include: |
| 88 | + - target-env: pypi |
| 89 | + target-url: https://pypi.org/p/nextmv |
| 90 | + - target-env: testpypi |
| 91 | + target-url: https://test.pypi.org/p/nextmv |
| 92 | + environment: |
| 93 | + name: ${{ matrix.target-env }} |
| 94 | + url: ${{ matrix.target-url }} |
| 95 | + permissions: |
| 96 | + contents: read |
| 97 | + id-token: write # This is required for trusted publishing to PyPI |
| 98 | + steps: |
| 99 | + - name: git clone develop |
| 100 | + uses: actions/checkout@v4 |
| 101 | + with: |
| 102 | + ref: develop |
92 | 103 |
|
93 |
| - - name: publish to PyPI |
94 |
| - env: |
95 |
| - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
96 |
| - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
97 |
| - run: twine upload dist/* |
98 |
| - working-directory: ./nextmv-py |
| 104 | + - name: set up Python |
| 105 | + uses: actions/setup-python@v4 |
| 106 | + with: |
| 107 | + python-version: "3.12" |
| 108 | + |
| 109 | + - name: install dependencies |
| 110 | + run: | |
| 111 | + pip install --upgrade pip |
| 112 | + pip install build hatch |
| 113 | +
|
| 114 | + - name: build binary wheel and source tarball |
| 115 | + run: python -m build |
| 116 | + |
| 117 | + - name: Publish package distributions to PyPI |
| 118 | + if: ${{ matrix.target-env == 'pypi' }} |
| 119 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 120 | + with: |
| 121 | + packages-dir: ./dist |
| 122 | + |
| 123 | + - name: Publish package distributions to TestPyPI |
| 124 | + if: ${{ matrix.target-env == 'testpypi' }} |
| 125 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 126 | + with: |
| 127 | + repository-url: https://test.pypi.org/legacy/ |
| 128 | + packages-dir: ./dist |
0 commit comments