|
1 |
| -# This will run every time a tag is created and pushed to the repository. |
| 1 | +# This will run every time a release is created and published. |
2 | 2 | # It calls our tests workflow via a `workflow_call`, and if tests pass
|
3 | 3 | # then it triggers our upload to PyPI for a new release.
|
4 | 4 | name: Publish to PyPI
|
5 | 5 | on:
|
6 | 6 | release:
|
7 |
| - types: ["published"] |
| 7 | + types: |
| 8 | + - published |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +env: |
| 12 | + FORCE_COLOR: "1" # Make tools pretty. |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + id-token: write # needed for PyPI upload |
8 | 17 |
|
9 | 18 | jobs:
|
| 19 | + # calls our tests workflow |
10 | 20 | tests:
|
11 | 21 | uses: ./.github/workflows/tests.yml
|
12 |
| - publish: |
13 |
| - name: publish |
| 22 | + |
| 23 | + build-package: |
| 24 | + name: "Build & verify PST package" |
14 | 25 | needs: [tests] # require tests to pass before deploy runs
|
15 | 26 | runs-on: ubuntu-latest
|
16 | 27 | steps:
|
17 |
| - - name: Checkout source |
| 28 | + - name: "Checkout repository 🛎" |
18 | 29 | uses: actions/checkout@v4
|
19 |
| - - name: Set up Python 3.9 |
| 30 | + |
| 31 | + - name: "Set up Python 3.9" |
20 | 32 | uses: actions/setup-python@v5
|
21 | 33 | with:
|
22 | 34 | python-version: "3.9"
|
23 |
| - - name: Install gettext for translations |
| 35 | + |
| 36 | + - name: "Install gettext for translations 🌐" |
24 | 37 | run: |
|
25 | 38 | sudo apt-get install gettext
|
26 |
| - - name: Build package |
27 |
| - run: | |
28 |
| - python -m pip install -U pip build |
29 |
| - python -m build |
30 |
| - - name: Publish |
31 |
| - uses: pypa/gh-action-pypi-publish@release/v1 |
| 39 | +
|
| 40 | + - name: "Build and inspect package 📦" |
| 41 | + uses: hynek/build-and-inspect-python-package@v2 |
| 42 | + id: baipp |
| 43 | + |
| 44 | + - run: echo Packages can be found at ${{ steps.baipp.outputs.dist }} |
| 45 | + |
| 46 | + release-pypi: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + needs: [build-package] |
| 49 | + steps: |
| 50 | + - name: "Download PST built package 📦" |
| 51 | + uses: actions/download-artifact@v4 |
32 | 52 | with:
|
33 |
| - user: __token__ |
34 |
| - password: ${{ secrets.PYPI_KEY }} |
| 53 | + name: PST-package |
| 54 | + path: dist |
| 55 | + |
| 56 | + - name: "Publish PST package to PyPI 🚀" |
| 57 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 58 | + # only publish if this is a published release by pydata |
| 59 | + if: github.repository_owner == 'pydata' && github.event_name == 'release' && github.event.action == 'published' |
0 commit comments