Skip to content
Merged
85 changes: 55 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Test
on:
push:
branches:
- master
paths-ignore:
- 'doc/**'
pull_request:
Expand Down Expand Up @@ -31,7 +33,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
persist-credentials: false

- name: Set up Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v6
Expand All @@ -55,7 +57,7 @@ jobs:

build:
name: build distribution
if: github.repository_owner == 'sphinx-doc' && github.ref == 'refs/heads/master'
if: ${{ github.repository_owner == 'sphinx-doc' && github.ref == 'refs/heads/master' }}
needs:
- tests
runs-on: ubuntu-latest
Expand All @@ -64,7 +66,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
persist-credentials: false
fetch-depth: 0

- name: Set up Python
uses: astral-sh/setup-uv@v6
Expand All @@ -78,9 +81,32 @@ jobs:
name: distributions
path: dist/

pypi-publish:
publish-to-testpypi:
name: Upload release to TestPyPI
if: ${{ github.repository_owner == 'sphinx-doc' && github.ref == 'refs/heads/master' }} # only publish to TestPyPI on push to master
needs:
- build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/sphinx-intl
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: distributions
path: dist/
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
repository-url: https://test.pypi.org/legacy/

publish-to-pypi:
name: Upload release to PyPI
if: github.repository_owner == 'sphinx-doc' && startsWith(github.ref, 'refs/tags/')
if: ${{ github.repository_owner == 'sphinx-doc' && startsWith(github.ref, 'refs/tags/') }}
needs:
- build
runs-on: ubuntu-latest
Expand All @@ -102,36 +128,35 @@ jobs:
with:
verbose: true

# for test
password: ${{ secrets.TESTPYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/

# for production
# password: ${{ secrets.PYPI_TOKEN }}

github-release:
name: GitHub release
if: github.repository_owner == 'sphinx-doc'
name: Sign the Python 🐍 distribution 📦 with Sigstore and upload them to GitHub Release
if: ${{ github.repository_owner == 'sphinx-doc' && startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
needs:
- pypi-publish
- publish-to-pypi
environment: release
permissions:
contents: write # for softprops/action-gh-release to create GitHub release

contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Get release version
id: get_version
uses: actions/github-script@v7
- name: Download all the dists
uses: actions/download-artifact@v4
with:
script: core.setOutput('version', context.ref.replace("refs/tags/", ""))

- name: Create GitHub release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
name: distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
name: "sphinx-intl ${{ steps.get_version.outputs.version }}"
body: "Changelog: https://sphinx-intl.readthedocs.io/en/master/changes.html"
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
"$GITHUB_REF_NAME" dist/**
--repo "$GITHUB_REPOSITORY"
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Environments
------------

* add python-3.14 support by @rffontenelle in https://github.com/sphinx-doc/sphinx-intl/pull/115
* Release to PyPI with digital attestations (PEP-740) by @shimizukawa in https://github.com/sphinx-doc/sphinx-intl/pull/125

Incompatibility
---------------
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ build-backend = "setuptools.build_meta"
include-package-data = true

[tool.setuptools_scm]
# this empty section means: use_scm_version=True
# https://setuptools-scm.readthedocs.io/en/latest/extending/#available-implementations_1
# because pypi does not support local version like .devN+<local_version>
local_scheme = "no-local-version"

[tool.mypy]
ignore_missing_imports = true
Expand Down