feat: Add CLI and enhance documentation (#7) #1
This file contains hidden or 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
| # Publish to PyPI — triggered by pushing a version tag (v*.*.*). | ||
| # Uses Trusted Publishing (OIDC — no API tokens required). | ||
| # | ||
| # One-time setup on PyPI: | ||
| # 1. Create a project for "strands-compose" at https://pypi.org/manage/account/publishing/ | ||
| # 2. Configure Trusted Publisher: | ||
| # - Owner: strands-compose | ||
| # - Repository: sdk-python | ||
| # - Workflow: publish.yml | ||
| # - Environment: release | ||
| name: Publish | ||
| on: | ||
| push: | ||
| tags: | ||
| - "v[0-9]+.[0-9]+.[0-9]+" | ||
| - "v[0-9]+.[0-9]+.[0-9]+.post*" | ||
| - "v[0-9]+.[0-9]+.[0-9]+rc*" | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| # ── Gate: run CI checks before publishing ───────────────────────────────── | ||
| ci: | ||
| uses: ./.github/workflows/ci.yml | ||
|
Check failure on line 27 in .github/workflows/publish.yml
|
||
| permissions: | ||
| contents: read | ||
| # ── Build distribution package ──────────────────────────────────────────── | ||
| # Pure Python package — one wheel (py3-none-any) runs on every OS and arch. | ||
| # No need for cibuildwheel or a platform matrix. | ||
| build: | ||
| name: Build | ||
| needs: ci | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| enable-cache: true | ||
| - name: Build wheel + sdist | ||
| run: uv build --out-dir dist/ | ||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| if-no-files-found: error | ||
| # ── Publish to PyPI ─────────────────────────────────────────────────────── | ||
| publish: | ||
| name: Publish to PyPI | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| environment: release | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - name: Download build artifacts | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| packages-dir: dist/ | ||
| # ── Create GitHub Release with CHANGELOG notes ──────────────────────────── | ||
| github-release: | ||
| name: GitHub Release | ||
| needs: publish | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| enable-cache: true | ||
| - name: Install dev deps | ||
| run: uv sync --group dev | ||
| - name: Extract changelog for this version | ||
| id: changelog | ||
| run: | | ||
| VERSION="${GITHUB_REF_NAME#v}" | ||
| NOTES=$(uv run python -c " | ||
| import re, pathlib | ||
| text = pathlib.Path('CHANGELOG.md').read_text() | ||
| match = re.search( | ||
| r'(?:^|\n)(## v?' + re.escape('$VERSION') + r'[^\n]*\n.*?)(?=\n## |\Z)', | ||
| text, re.DOTALL | ||
| ) | ||
| print(match.group(1).strip() if match else 'See CHANGELOG.md for details.') | ||
| " VERSION="$VERSION") | ||
| { | ||
| echo 'notes<<EOF' | ||
| echo "$NOTES" | ||
| echo EOF | ||
| } >> "$GITHUB_OUTPUT" | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| path: dist-all/ | ||
| merge-multiple: true | ||
| - name: Create GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| body: ${{ steps.changelog.outputs.notes }} | ||
| files: dist-all/**/* | ||
| prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') }} | ||