Publish PST package #360
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow runs every day at 2AM UTC to publish a new nightly release to Anaconda.org | |
# and every time there is a PST release to make sure it gets uploaded to PyPI. | |
name: Publish PST package | |
on: | |
release: | |
types: | |
- published | |
schedule: | |
- cron: "0 2 * * *" # at 2AM UTC | |
workflow_dispatch: | |
env: | |
FORCE_COLOR: "1" # Make tools pretty. | |
permissions: | |
contents: read | |
jobs: | |
# calls our general CI workflows (tests, coverage, profile, etc.) | |
tests: | |
# Important: make sure to update the SHA after making any changes to the CI workflow | |
uses: pydata/pydata-sphinx-theme/.github/workflows/CI.yml@ac57147185b6f9400cafbcd852e04345e5e841b7 | |
# only run this workflow for pydata owned repositories (avoid forks) | |
if: github.repository_owner == 'pydata' | |
# needed for the coverage action | |
permissions: | |
contents: write | |
pull-requests: write | |
actions: read | |
# calls our docs workflow (build docs, check broken links, lighthouse) | |
docs: | |
# Important: make sure to update the SHA after making any changes to the docs workflow | |
uses: pydata/pydata-sphinx-theme/.github/workflows/docs.yml@ac57147185b6f9400cafbcd852e04345e5e841b7 | |
# only run this workflow for pydata owned repositories (avoid forks) | |
if: github.repository_owner == 'pydata' | |
build-package: | |
name: "Build & verify PST package" | |
# require tests and docs to pass before building the package | |
needs: [tests, docs] | |
# only run this workflow for pydata owned repositories (avoid forks) | |
if: github.repository_owner == 'pydata' | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout repository 🛎" | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 | |
with: | |
persist-credentials: false | |
- name: "Setup Python 🐍" | |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # 5.4.0 | |
with: | |
python-version: "3.9" | |
- run: python -Im pip install tox-uv | |
- name: "Build and inspect package 📦" | |
uses: hynek/build-and-inspect-python-package@b5076c307dc91924a82ad150cdd1533b444d3310 # 2.12.0 | |
id: baipp | |
- run: echo Packages can be found at "${BAIPP_DIST}" | |
env: | |
BAIPP_DIST: ${{ steps.baipp.outputs.dist }} | |
# Run tests on the built package (which will be later uploaded to PyPI) | |
- name: "Install PST from wheel and test" | |
env: | |
BAIPP_DIST: ${{ steps.baipp.outputs.dist }} | |
run: | | |
dist_loc="${BAIPP_DIST}" | |
# calling with --installpkg so we can use the already built package | |
tox run -e py312-tests-no-cov \ | |
--installpkg $dist_loc/*.whl \ | |
-- --deselect tests/test_build.py::test_translations | |
release-PST: | |
runs-on: ubuntu-latest | |
needs: [build-package] | |
# only run this workflow for pydata owned repositories (avoid forks) | |
if: github.repository_owner == 'pydata' | |
permissions: | |
id-token: write # needed for PyPI upload | |
environment: | |
name: pst-release | |
url: https://pypi.org/p/pydata-sphinx-theme | |
steps: | |
- name: "Download PST built package 📦" | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8 | |
with: | |
name: Packages | |
path: dist | |
- name: "Unzip artifact" | |
run: | | |
tar xvf dist/*.tar.gz --strip-components=1 | |
- name: "Publish PST package to PyPI 🚀" | |
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # 1.12.3 | |
# only publish if this is a published release by pydata | |
if: github.repository_owner == 'pydata' && github.event_name == 'release' && github.event.action == 'published' | |
with: | |
print-hash: true | |
- name: "Publish PST package to scientific-python-nightly-wheels 🚀" | |
uses: scientific-python/upload-nightly-action@82396a2ed4269ba06c6b2988bb4fd568ef3c3d6b # 0.6.1 | |
with: | |
artifacts_path: dist | |
anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN }} | |
if: github.repository_owner == 'pydata' && github.event_name == 'schedule' |