Debian Codegraph @

.github/workflows/publish.yml

raw
1 # This workflow runs every day at 2AM UTC to publish a new nightly release to Anaconda.org
2 # and every time there is a PST release to make sure it gets uploaded to PyPI.
3 name: Publish PST package
4 on:
5 release:
6 types:
7 - published
8 schedule:
9 - cron: "0 2 * * *" # at 2AM UTC
10 workflow_dispatch:
11
12 env:
13 FORCE_COLOR: "1" # Make tools pretty.
14
15 permissions:
16 contents: read
17
18 jobs:
19 # calls our general CI workflows (tests, coverage, profile, etc.)
20 tests:
21 # Important: make sure to update the SHA after making any changes to the CI workflow
22 uses: pydata/pydata-sphinx-theme/.github/workflows/CI.yml@cd00a86a87aba3903543c00c5ce5f009c436e0b1
23 # only run this workflow for pydata owned repositories (avoid forks)
24 if: github.repository_owner == 'pydata'
25 # needed for the coverage action
26 permissions:
27 contents: write
28 pull-requests: write
29 actions: read
30 # calls our docs workflow (build docs, check broken links, lighthouse)
31 docs:
32 # Important: make sure to update the SHA after making any changes to the docs workflow
33 uses: pydata/pydata-sphinx-theme/.github/workflows/docs.yml@cd00a86a87aba3903543c00c5ce5f009c436e0b1
34 # only run this workflow for pydata owned repositories (avoid forks)
35 if: github.repository_owner == 'pydata'
36
37 build-package:
38 name: "Build & verify PST package"
39 # require tests and docs to pass before building the package
40 needs: [tests, docs]
41 # only run this workflow for pydata owned repositories (avoid forks)
42 if: github.repository_owner == 'pydata'
43 runs-on: ubuntu-latest
44 steps:
45 - name: "Checkout repository 🛎"
46 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
47 with:
48 persist-credentials: false
49
50 - name: "Setup Python 🐍"
51 uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # 6.2.0
52 with:
53 python-version: "3.10"
54
55 - run: python -Im pip install tox-uv
56
57 - name: "Build and inspect package 📦"
58 uses: hynek/build-and-inspect-python-package@fe0a0fb1925ca263d076ca4f2c13e93a6e92a33e # 2.17.0
59 id: baipp
60 with:
61 # pydantic-core (via PyO3) does not yet support Python 3.14
62 python-version: "3.13"
63
64 - run: echo Packages can be found at "${BAIPP_DIST}"
65 env:
66 BAIPP_DIST: ${{ steps.baipp.outputs.dist }}
67
68 # Run tests on the built package (which will be later uploaded to PyPI)
69 - name: "Install PST from wheel and test"
70 env:
71 BAIPP_DIST: ${{ steps.baipp.outputs.dist }}
72 run: |
73 dist_loc="${BAIPP_DIST}"
74 # calling with --installpkg so we can use the already built package
75 tox run -e py312-tests-no-cov \
76 --installpkg $dist_loc/*.whl \
77 -- --deselect tests/test_build.py::test_translations
78
79 nightly-release-PST:
80 runs-on: ubuntu-latest
81 needs: [build-package]
82 # only run this workflow for pydata owned repositories (avoid forks)
83 if: github.repository_owner == 'pydata'
84 environment:
85 name: pst-release
86 steps:
87 - name: "Download PST built package 📦"
88 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
89 with:
90 name: Packages
91 path: dist
92
93 - name: "Unzip artifact"
94 run: |
95 tar xvf dist/*.tar.gz --strip-components=1
96
97 - name: "Publish PST package to scientific-python-nightly-wheels 🚀"
98 uses: scientific-python/upload-nightly-action@5748273c71e2d8d3a61f3a11a16421c8954f9ecf # 0.6.3
99 with:
100 artifacts_path: dist
101 anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }}
102 if: github.repository_owner == 'pydata' && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
103
104 release-PST:
105 runs-on: ubuntu-latest
106 needs: [build-package]
107 # only run this workflow for pydata owned repositories (avoid forks)
108 if: github.repository_owner == 'pydata'
109 permissions:
110 id-token: write # needed for PyPI upload
111 environment:
112 name: pst-release
113 url: https://pypi.org/p/pydata-sphinx-theme
114 steps:
115 - name: "Download PST built package 📦"
116 uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # 8.0.1
117 with:
118 name: Packages
119 path: dist
120
121 - name: "Unzip artifact"
122 run: |
123 tar xvf dist/*.tar.gz --strip-components=1
124
125 - name: "Publish PST package to PyPI 🚀"
126 uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # 1.13.0
127 # only publish if this is a published release by pydata
128 if: github.repository_owner == 'pydata' && github.event_name == 'release' && github.event.action == 'published'
129 with:
130 print-hash: true