Debian Codegraph @

testing/web-platform/tests/tools/third_party/attrs/.github/workflows/pypi-package.yml

raw
1 ---
2 name: Build & maybe upload PyPI package
3
4 on:
5 push:
6 branches: [main]
7 tags: ["*"]
8 pull_request:
9 branches: [main]
10 release:
11 types:
12 - published
13 workflow_dispatch:
14
15 permissions:
16 contents: read
17 id-token: write
18
19 jobs:
20 # Always build & lint package.
21 build-package:
22 name: Build & verify package
23 runs-on: ubuntu-latest
24
25 steps:
26 - uses: actions/checkout@v4
27 with:
28 fetch-depth: 0
29
30 - uses: hynek/build-and-inspect-python-package@v2
31
32 # Upload to Test PyPI on every commit on main.
33 release-test-pypi:
34 name: Publish in-dev package to test.pypi.org
35 environment: release-test-pypi
36 if: github.repository_owner == 'python-attrs' && github.event_name == 'push' && github.ref == 'refs/heads/main'
37 runs-on: ubuntu-latest
38 needs: build-package
39
40 steps:
41 - name: Download packages built by build-and-inspect-python-package
42 uses: actions/download-artifact@v4
43 with:
44 name: Packages
45 path: dist
46
47 - name: Upload package to Test PyPI
48 uses: pypa/gh-action-pypi-publish@release/v1
49 with:
50 repository-url: https://test.pypi.org/legacy/
51
52 # Upload to real PyPI on GitHub Releases.
53 release-pypi:
54 name: Publish released package to pypi.org
55 environment: release-pypi
56 if: github.repository_owner == 'python-attrs' && github.event.action == 'published'
57 runs-on: ubuntu-latest
58 needs: build-package
59
60 steps:
61 - name: Download packages built by build-and-inspect-python-package
62 uses: actions/download-artifact@v4
63 with:
64 name: Packages
65 path: dist
66
67 - name: Upload package to PyPI
68 uses: pypa/gh-action-pypi-publish@release/v1