|
1 | 1 | name: Publish Python distribution to PyPI and TestPyPI |
2 | | -on: push |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - '*' |
3 | 6 |
|
4 | 7 | jobs: |
5 | 8 | build-wheel: |
6 | | - name: build wheel for testing |
| 9 | + uses: ./.github/workflows/pypackage.yml |
| 10 | + upload_testpypi: |
| 11 | + name: Publish build to TestPyPI |
| 12 | + needs: [build-wheel] |
7 | 13 | runs-on: ubuntu-latest |
| 14 | + environment: |
| 15 | + name: pypi |
| 16 | + url: https://test.pypi.org/p/UncertainSCI |
| 17 | + permissions: |
| 18 | + id-token: write |
8 | 19 | steps: |
9 | | - - uses: actions/checkout@v3 |
10 | | - - name: Setup Python 3.9 |
11 | | - uses: actions/setup-python@v3 |
| 20 | + - uses: actions/download-artifact@v3 |
12 | 21 | with: |
13 | | - python-version: 3.9 |
14 | | - - name: Install pypa/build |
15 | | - run: >- |
16 | | - python -m |
17 | | - pip install |
18 | | - build |
19 | | - --user |
20 | | - - name: Build a binary wheel and a source tarball |
21 | | - run: >- |
22 | | - python -m |
23 | | - build |
24 | | - --sdist |
25 | | - --wheel |
26 | | - --outdir dist/ |
27 | | - - name: install check-wheel-contents |
28 | | - run: >- |
29 | | - python3 -m |
30 | | - pip install |
31 | | - check-wheel-contents |
32 | | - - name: check wheel |
33 | | - run: >- |
34 | | - check-wheel-contents |
35 | | - dist/*.whl |
36 | | - - uses: actions/upload-artifact@v3 |
| 22 | + name: artifact |
| 23 | + path: dist |
| 24 | + - name: Upload to TestPyPI |
| 25 | + uses: pypa/gh-action-pypi-publish@release/v1 |
37 | 26 | with: |
38 | | - path: ./dist/* |
39 | | - |
| 27 | + packages-dir: dist |
40 | 28 | upload_pypi: |
41 | | - needs: build-wheel |
42 | | - name: Publish build to TestPyPI and PyPI |
| 29 | + name: Publish build to PyPI |
| 30 | + needs: [build-wheel, upload_testpypi] |
43 | 31 | runs-on: ubuntu-latest |
44 | 32 | environment: |
45 | 33 | name: pypi |
46 | 34 | url: https://pypi.org/p/UncertainSCI |
47 | 35 | permissions: |
48 | 36 | id-token: write |
49 | | - if: startsWith(github.event.ref, 'refs/tags') |
50 | 37 | steps: |
51 | 38 | - uses: actions/download-artifact@v3 |
52 | 39 | with: |
53 | 40 | name: artifact |
54 | 41 | path: dist |
55 | | - - name: Upload to TestPyPI |
56 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
57 | | - with: |
58 | | - repository_url: https://test.pypi.org/legacy/ |
59 | 42 | - name: Upload to PyPI |
60 | 43 | uses: pypa/gh-action-pypi-publish@release/v1 |
| 44 | + with: |
| 45 | + packages-dir: dist |
0 commit comments