Debian Codegraph @

.github/workflows/publish.yml

raw symbols SCIP
1 name: Build and Publish to PyPI or TestPyPI
2
3 on: push
4
5 jobs:
6 build:
7 name: Build distribution
8 runs-on: ubuntu-latest
9 steps:
10 - uses: actions/checkout@v4
11 - name: Set up Python
12 uses: actions/setup-python@v4
13 with:
14 python-version: "3.x"
15 - name: Install Hatch
16 run: pipx install hatch
17 - name: Build
18 run: hatch build
19 - name: Store the distribution packages
20 uses: actions/upload-artifact@v4
21 with:
22 name: python-package-distributions
23 path: dist/
24
25 publish-to-pypi:
26 name: Publish distributions to PyPI
27 if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
28 needs:
29 - build
30 runs-on: ubuntu-latest
31 environment:
32 name: pypi
33 url: https://pypi.org/p/wn
34 permissions:
35 id-token: write # IMPORTANT: mandatory for trusted publishing
36 steps:
37 - name: Download the dists
38 uses: actions/[email protected]
39 with:
40 name: python-package-distributions
41 path: dist/
42 - name: Publish to PyPI
43 uses: pypa/gh-action-pypi-publish@release/v1
44
45 publish-to-testpypi:
46 name: Publish distributions to TestPyPI
47 needs:
48 - build
49 runs-on: ubuntu-latest
50 environment:
51 name: testpypi
52 url: https://test.pypi.org/p/wn
53 permissions:
54 id-token: write # IMPORTANT: mandatory for trusted publishing
55 steps:
56 - name: Download the dists
57 uses: actions/[email protected]
58 with:
59 name: python-package-distributions
60 path: dist/
61 - name: Publish to TestPyPI
62 uses: pypa/gh-action-pypi-publish@release/v1
63 with:
64 repository-url: https://test.pypi.org/legacy/
65 skip-existing: true