|
5 | 5 | # This workflow uploads a Python Package using Twine when a release is created. |
6 | 6 | # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries |
7 | 7 |
|
8 | | -# name: Upload Python Package |
| 8 | +name: Upload Python Package |
9 | 9 |
|
10 | | -# on: |
11 | | -# release: |
12 | | -# types: [created, edited] |
| 10 | +on: |
| 11 | + release: |
| 12 | + types: [ created, edited ] |
13 | 13 |
|
14 | | -# jobs: |
15 | | -# tests: |
16 | | -# if: startsWith(github.ref, 'refs/tags/v') |
17 | | -# runs-on: ${{ matrix.os }} |
18 | | -# strategy: |
19 | | -# matrix: |
20 | | -# python-version: ["3.12"] |
21 | | -# os: [ubuntu-latest] |
22 | | -# steps: |
23 | | -# - uses: actions/checkout@v4 |
24 | | -# - name: Set up Python ${{ matrix.python-version }} |
25 | | -# uses: actions/setup-python@v5 |
26 | | -# with: |
27 | | -# python-version: ${{ matrix.python-version }} |
28 | | -# - name: Install tox |
29 | | -# run: | |
30 | | -# python -m pip install --upgrade pip |
31 | | -# pip install tox |
32 | | -# - name: Run tox |
33 | | -# run: | |
34 | | -# tox |
35 | | - |
36 | | -# build-n-publish: |
37 | | -# name: Build and publish Python π distributions π¦ to PyPI and TestPyPI |
38 | | -# runs-on: ${{ matrix.os }} |
39 | | -# strategy: |
40 | | -# matrix: |
41 | | -# python-version: [ "3.12" ] |
42 | | -# os: [ ubuntu-latest ] |
43 | | -# # Specifying a GitHub environment, # Specifying a GitHub environment, which is strongly recommended by PyPI: https://docs.pypi.org/trusted-publishers/adding-a-publisher/ |
44 | | -# # you have to create an environment in your repository settings and add the environment name here |
45 | | -# environment: release |
46 | | -# permissions: |
47 | | -# # IMPORTANT: this permission is mandatory for trusted publishing |
48 | | -# id-token: write |
49 | | -# needs: tests |
50 | | -# steps: |
51 | | -# - uses: actions/checkout@v4 |
52 | | -# - name: Set up Python ${{ matrix.python-version }} |
53 | | -# uses: actions/setup-python@v5 |
54 | | -# with: |
55 | | -# python-version: ${{ matrix.python-version }} |
56 | | -# - name: Install dependencies |
57 | | -# run: | |
58 | | -# python -m pip install --upgrade pip |
59 | | -# pip install -r dev_requirements/requirements-packaging.txt |
60 | | -# - name: Build wheel and source distributions |
61 | | -# run: | |
62 | | -# python -m build |
63 | | -# - name: Publish distribution π¦ to PyPI |
64 | | -# if: startsWith(github.ref, 'refs/tags/v') |
65 | | -# uses: pypa/gh-action-pypi-publish@release/v1 |
| 14 | +jobs: |
| 15 | + tests: |
| 16 | + if: startsWith(github.ref, 'refs/tags/v') |
| 17 | + runs-on: ${{ matrix.os }} |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + python-version: [ "3.12" ] |
| 21 | + os: [ ubuntu-latest ] |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + - name: Set up Python ${{ matrix.python-version }} |
| 25 | + uses: actions/setup-python@v5 |
| 26 | + with: |
| 27 | + python-version: ${{ matrix.python-version }} |
| 28 | + - name: Install tox |
| 29 | + run: | |
| 30 | + python -m pip install --upgrade pip |
| 31 | + pip install tox |
| 32 | + - name: Run tox |
| 33 | + run: | |
| 34 | + tox |
66 | 35 |
|
| 36 | + build-n-publish: |
| 37 | + name: Build and publish Python π distributions π¦ to PyPI and TestPyPI |
| 38 | + runs-on: ${{ matrix.os }} |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + python-version: [ "3.12" ] |
| 42 | + os: [ ubuntu-latest ] |
| 43 | + # Specifying a GitHub environment, # Specifying a GitHub environment, which is strongly recommended by PyPI: https://docs.pypi.org/trusted-publishers/adding-a-publisher/ |
| 44 | + # you have to create an environment in your repository settings and add the environment name here |
| 45 | + environment: release |
| 46 | + permissions: |
| 47 | + # IMPORTANT: this permission is mandatory for trusted publishing |
| 48 | + id-token: write |
| 49 | + needs: tests |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v4 |
| 52 | + - name: Set up Python ${{ matrix.python-version }} |
| 53 | + uses: actions/setup-python@v5 |
| 54 | + with: |
| 55 | + python-version: ${{ matrix.python-version }} |
| 56 | + - name: Install dependencies |
| 57 | + run: | |
| 58 | + python -m pip install --upgrade pip |
| 59 | + pip install -r dev_requirements/requirements-packaging.txt |
| 60 | + - name: Build wheel and source distributions |
| 61 | + run: | |
| 62 | + python -m build |
| 63 | + - name: Publish distribution π¦ to PyPI |
| 64 | + if: startsWith(github.ref, 'refs/tags/v') |
| 65 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments