Correct a spelling mistake #17
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
name: Releases | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
generate-test-matrix: | |
name: Generate test matrix | |
runs-on: ubuntu-latest | |
outputs: | |
folders: ${{ steps.get-folders.outputs.folders }} | |
steps: | |
- name: Check out code from Github | |
uses: actions/checkout@v4 | |
- name: Get folders with tests | |
id: get-folders | |
run: | | |
pip install -U pip -r requirements_test.txt | |
FOLDERS=$(python scripts/helper.py list-test-folders --exclude distutils) | |
echo "folders: ${FOLDERS}" | |
echo "folders=${FOLDERS}" >> $GITHUB_OUTPUT | |
build: | |
name: Run build | |
runs-on: ubuntu-latest | |
needs: [generate-test-matrix] | |
strategy: | |
fail-fast: false | |
matrix: | |
folder: ${{ fromJson(needs.generate-test-matrix.outputs.folders) }} | |
version: ["3.13"] | |
steps: | |
- name: Check out code from Github | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.version }} | |
check-latest: true | |
- name: Run tests | |
run: | | |
cd ${{ matrix.folder }} | |
pip install build | |
python -m build | |
- name: Upload packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.folder }} | |
path: ${{ matrix.folder }}/dist | |
publish-to-pypi: | |
name: Release | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} | |
needs: [build] | |
permissions: | |
# Use to sign the release artifacts | |
id-token: write | |
# Used to upload release artifacts | |
contents: write | |
# Used to generate artifact attestation | |
attestations: write | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: dist-* | |
path: dist | |
merge-multiple: true | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
github-release: | |
name: >- | |
Sign the Python 🐍 distribution 📦 with Sigstore | |
and upload them to GitHub Release | |
needs: | |
- publish-to-pypi | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # IMPORTANT: mandatory for making GitHub Releases | |
id-token: write # IMPORTANT: mandatory for sigstore | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: dist-* | |
path: dist | |
merge-multiple: true | |
- name: Sign the dists with Sigstore | |
uses: sigstore/gh-action-sigstore-python@v3.0.0 | |
with: | |
inputs: >- | |
./dist/*.tar.gz | |
./dist/*.whl | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: >- | |
gh release create | |
'${{ github.ref_name }}' | |
--repo '${{ github.repository }}' | |
--notes "" | |
- 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 }}' |