name: Build and Publish Package # Publishes two distributions from one release: `harlequin`, and the `hsql` # metapackage in packaging/hsql, which carries the same version number and # pins this release exactly. Both are registered with PyPI's trusted publisher # against this filename and the `publish` environment below; renaming either # one breaks publishing, for both projects. on: pull_request: branches: - main types: - closed jobs: publish-package: if: ${{ github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v') }} runs-on: ubuntu-latest environment: publish permissions: id-token: write steps: - name: Check out harlequin main branch uses: actions/checkout@v7 with: ref: main - name: Set up Python 3.10 uses: actions/setup-python@v7 with: python-version: "3.10" - name: Install uv uses: astral-sh/setup-uv@v10.1.0 with: version: "0.12.13" - name: Get harlequin Version id: harlequin_version run: echo "harlequin_version=$(uv version --short)" >> $GITHUB_OUTPUT - name: Build package run: uv build --all-packages - name: Build hsql metapackage run: uv build packaging/hsql --out-dir dist - name: Check that hsql pins this release run: | version="${{ steps.harlequin_version.outputs.harlequin_version }}" if [ ! -f "dist/hsql-$version.tar.gz" ]; then echo "::error::dist/ has no hsql-$version; hsql is out of step with harlequin." ls -la dist/ exit 1 fi - name: Publish packages to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - name: Create a Github Release uses: softprops/action-gh-release@v3 with: tag_name: v${{ steps.harlequin_version.outputs.harlequin_version }} target_commitish: main token: ${{ secrets.HARLEQUIN_RELEASE_TOKEN }} body_path: CHANGELOG.md files: | LICENSE dist/*harlequin*.whl dist/*harlequin*.tar.gz dist/*hsql*.whl dist/*hsql*.tar.gz # the site vendors this release's generated artifacts -- the config schema, # the CLI reference and the skill -- so it publishes after PyPI does, when # the version the manifest names is one a reader can install. publish-artifacts: needs: publish-package uses: ./.github/workflows/publish-artifacts.yml secrets: inherit