Skip to content

CD

CD #22

Workflow file for this run

name: CD
on:
release:
types: [published]
workflow_dispatch:
schedule:
- cron: "0 3 * * 1"
env:
FORCE_COLOR: 3
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.2.2
with:
# include tags so that hatch-vcs can infer the version
fetch-depth: 0
# switch to fetch-tags: true when the following is fixed
# see https://github.com/actions/checkout/issues/2041
# fetch-tags: true
- name: Setup Python
uses: actions/setup-python@bba65e51ff35d50c6dbaaacd8a4681db13aa7cb4 # v5.6.0
with:
python-version: "3.12"
- name: Build
run: |
python -m pip install build
python -m build .
- name: Store the distribution packages
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: python-package-distributions
path: dist/
if-no-files-found: error
publish:
name: Publish to PyPI
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
environment:
name: pypi
url: https://pypi.org/p/sphinx-js
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
attestations: write
contents: read
steps:
- name: Download all the dists
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
path: dist/
merge-multiple: true
- name: Generate artifact attestations
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3.0.0
with:
subject-path: "dist/*"
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0