Fix Windows glob pattern in publish workflow

This commit is contained in:
GitHub Actions 2025-07-20 20:05:41 +00:00
parent 8974cdf0e5
commit 1b35ac44a2

View File

@ -1,106 +1,106 @@
name: Publish to PyPI name: Publish to PyPI
on: on:
release: release:
types: [published] types: [published]
workflow_dispatch: workflow_dispatch:
inputs: inputs:
test_pypi: test_pypi:
description: 'Publish to TestPyPI instead of PyPI' description: 'Publish to TestPyPI instead of PyPI'
required: false required: false
type: boolean type: boolean
default: true default: true
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.11' python-version: '3.11'
- name: Install build dependencies - name: Install build dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install build twine pip install build twine
- name: Build package - name: Build package
run: python -m build run: python -m build
- name: Check package - name: Check package
run: twine check dist/* run: twine check dist/*
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: dist name: dist
path: dist/ path: dist/
test-install: test-install:
needs: build needs: build
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.12"] python-version: ["3.8", "3.12"]
steps: steps:
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Download artifacts - name: Download artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: dist name: dist
path: dist/ path: dist/
- name: Test installation - name: Test installation
shell: bash shell: bash
run: | run: |
pip install dist/*.whl pip install dist/*.whl
python -c "import sqrtspace_spacetime; print(sqrtspace_spacetime.__version__)" python -c "import sqrtspace_spacetime; print(sqrtspace_spacetime.__version__)"
publish-testpypi: publish-testpypi:
if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_pypi == 'true' if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_pypi == 'true'
needs: test-install needs: test-install
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: testpypi environment: testpypi
permissions: permissions:
id-token: write id-token: write
steps: steps:
- name: Download artifacts - name: Download artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: dist name: dist
path: dist/ path: dist/
- name: Publish to TestPyPI - name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1
with: with:
repository-url: https://test.pypi.org/legacy/ repository-url: https://test.pypi.org/legacy/
skip-existing: true skip-existing: true
publish-pypi: publish-pypi:
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_pypi == 'false') if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.test_pypi == 'false')
needs: test-install needs: test-install
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: pypi environment: pypi
permissions: permissions:
id-token: write id-token: write
steps: steps:
- name: Download artifacts - name: Download artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: dist name: dist
path: dist/ path: dist/
- name: Publish to PyPI - name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1