Skip to content

Merge pull request #25 from saraswatayu/docs/booking-ota-examples #83

Merge pull request #25 from saraswatayu/docs/booking-ota-examples

Merge pull request #25 from saraswatayu/docs/booking-ota-examples #83

Workflow file for this run

name: swoop
on:
push:
branches: [main]
tags: ['swoop-v*']
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: make install-dev
- name: Run offline test suite
run: make test
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Install build tools
run: pip install build
- name: Build package
run: python -m build
- name: Verify wheel contents
run: |
python -c "
import zipfile, sys
whl = [f for f in __import__('os').listdir('dist') if f.endswith('.whl')][0]
zf = zipfile.ZipFile(f'dist/{whl}')
names = zf.namelist()
assert any('py.typed' in n for n in names), 'py.typed missing from wheel'
assert any('__init__.py' in n for n in names), '__init__.py missing from wheel'
print(f'Wheel OK: {len(names)} files')
"
publish:
needs: [test, build]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/swoop-v')
environment: pypi
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- name: Install build tools
run: pip install build
- name: Build package
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
- name: Extract changelog for release
id: changelog
run: |
VERSION="${GITHUB_REF_NAME#swoop-v}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
# Extract the section between this version's header and the next version header
awk "/^## \\[${VERSION}\\]/{found=1; next} /^## \\[/{if(found) exit} found{print}" CHANGELOG.md > release-notes.md
cat release-notes.md
- name: Create GitHub Release
run: gh release create "${{ github.ref_name }}" --title "v${VERSION}" --notes-file release-notes.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.changelog.outputs.version }}