Skip to content

Build

Build #323

Workflow file for this run

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:
os: [ubuntu-20.04, windows-2019, macos-11]
steps:
- uses: actions/checkout@v3
with:
submodules: true
# Need full depth to have tags.
fetch-depth: 0
- name: Build wheels
uses: pypa/cibuildwheel@v2.12.1
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
# Need full depth to have tags.
fetch-depth: 0
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.11'
- name: Build sdist
run: |
pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
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@v3.0.2
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@v1.8.6