Build #422
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: Build | |
on: | |
# Don't run on every push, this takes a while. | |
# push: | |
# branches: [ master ] | |
schedule: | |
- cron: '14 9 * * WED' # Run at 9:14 (7:14pm local) on Wednesday | |
create: | |
ref_type: 'tag' | |
workflow_dispatch: | |
# Allow triggering manually whenever it's useful. | |
permissions: | |
contents: read | |
pull-requests: read | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# macos-13 is an intel runner, macos-14 is apple silicon | |
os: [ubuntu-latest, windows-latest, macos-13] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
# Need full depth to have tags. | |
fetch-depth: 0 | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
# Need full depth to have tags. | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: '3.12' | |
- name: Build sdist | |
run: | | |
pipx run build --sdist | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
environment: | |
name: release | |
url: https://pypi.org/p/srctools/ | |
permissions: | |
id-token: write | |
# upload to PyPI on every tag starting with 'v' | |
if: (github.event_name == 'create' && github.event.ref_type == 'tag' && startsWith(github.event.ref, 'v')) || (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')) | |
# alternatively, to publish when a GitHub Release is created, use the following rule: | |
# if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- uses: pypa/[email protected] |