|
1 | 1 | # kics-scan disable=a88baa34-e2ad-44ea-ad6f-8cac87bc7c71,555ab8f9-2001-455e-a077-f2d0f41e2fb9 |
2 | 2 | --- |
3 | | -name: Upload Python Package |
| 3 | +name: Upload Python Package to PyPI and TestPyPI |
4 | 4 | permissions: read-all |
5 | 5 |
|
6 | | -on: |
7 | | - release: |
8 | | - types: [published] |
| 6 | +on: push |
9 | 7 |
|
10 | 8 | jobs: |
11 | | - pypi-publish: |
12 | | - name: Upload release to PyPI |
| 9 | + build: |
| 10 | + name: Build distribution 📦 |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v6 |
| 14 | + with: |
| 15 | + persist-credentials: false |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@v6 |
| 18 | + with: |
| 19 | + python-version: "3.x" |
| 20 | + - name: Install pypa/build |
| 21 | + run: >- |
| 22 | + python3 -m |
| 23 | + pip install |
| 24 | + build |
| 25 | + --user |
| 26 | + - name: Build a binary wheel and a source tarball |
| 27 | + run: python3 -m build |
| 28 | + - name: Store the distribution packages |
| 29 | + uses: actions/upload-artifact@v6 |
| 30 | + with: |
| 31 | + name: python-package-distributions |
| 32 | + path: dist/ |
| 33 | + |
| 34 | + publish-to-pypi: |
| 35 | + name: >- |
| 36 | + Publish Python 🐍 distribution 📦 to PyPI |
| 37 | + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes |
| 38 | + needs: |
| 39 | + - build |
13 | 40 | runs-on: ubuntu-latest |
14 | 41 | environment: |
15 | 42 | name: pypi |
16 | 43 | url: https://pypi.org/p/i18ntools |
17 | 44 | permissions: |
18 | | - id-token: write # IMPORTANT: this permission is mandatory for trusted publishing |
| 45 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
19 | 46 | steps: |
20 | | - - uses: actions/checkout@v6 |
21 | | - - name: Set up Python |
22 | | - uses: actions/setup-python@v6 |
| 47 | + - name: Download all the dists |
| 48 | + uses: actions/download-artifact@v6 |
| 49 | + with: |
| 50 | + name: python-package-distributions |
| 51 | + path: dist/ |
| 52 | + - name: Publish distribution 📦 to PyPI |
| 53 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 54 | + |
| 55 | + publish-to-testpypi: |
| 56 | + name: Publish Python 🐍 distribution 📦 to TestPyPI |
| 57 | + needs: |
| 58 | + - build |
| 59 | + runs-on: ubuntu-latest |
| 60 | + environment: |
| 61 | + name: testpypi |
| 62 | + url: https://test.pypi.org/p/java-properties-i18n-translation |
| 63 | + permissions: |
| 64 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 65 | + steps: |
| 66 | + - name: Download all the dists |
| 67 | + uses: actions/download-artifact@v6 |
| 68 | + with: |
| 69 | + name: python-package-distributions |
| 70 | + path: dist/ |
| 71 | + - name: Publish distribution 📦 to TestPyPI |
| 72 | + uses: pypa/gh-action-pypi-publish@release/v1 |
23 | 73 | with: |
24 | | - python-version: '3.x' |
25 | | - - name: Install dependencies |
26 | | - run: | |
27 | | - python -m pip install --upgrade pip |
28 | | - pip install build |
29 | | - - name: Build package |
30 | | - run: python -m build |
31 | | - - name: Publish package distributions to PyPI |
32 | | - uses: pypa/gh-action-pypi-publish@v1.11.0 |
| 74 | + repository-url: https://test.pypi.org/legacy/ |
0 commit comments