From fdca3a5cd5438461bfffc756bbb05b3ff8eb089b Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Wed, 21 Oct 2026 16:17:22 +0100 Subject: [PATCH 1/2] Use the same release process as the rest of Firedrake --- .github/workflows/pypi.yml | 108 ++++++++++++++++++++++++++++++------- 1 file changed, 90 insertions(+), 18 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 08f113d0..e215314a 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -1,32 +1,104 @@ -name: Upload release to pypi +name: Publish release + on: workflow_dispatch: - push: - tags: "v*" + inputs: + branch: + description: The branch to release from + type: string + required: true + version: + description: The version number to release + type: string + required: true + prev_version: + description: The previously most up-to-date version number + type: string + required: true jobs: - pypi-publish: - name: Upload release to PyPI + check: + name: Pre-release checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + with: + ref: ${{ inputs.branch }} + + - name: Check no 'TODO RELEASE' comments remain + run: | + if [ -z "$( grep -r --exclude-dir='.*' 'TODO RELEASE' )" ]; then + exit 0 + else + exit 1 + fi + + - name: Check version number matches + run: | + if [ -z "$( grep 'version = \"${{ inputs.version }}\"' pyproject.toml )" ]; then + exit 1 + else + exit 0 + fi + + build: + name: Build dist files + needs: check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + with: + ref: ${{ inputs.branch }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Build pyadjoint + run: | + pip install build + python -m build . + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + pypi: + name: Push dist to PyPI + needs: build runs-on: ubuntu-latest environment: name: pypi - url: https://pypi.org/p/pyadjoint-ad permissions: id-token: write - steps: - - uses: actions/checkout@v4 - - - name: Setup Python - uses: actions/setup-python@v4 + - name: Download artifacts + uses: actions/download-artifact@v4 with: - python-version: "3.10" + name: dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 - - name: Install dependencies - run: python3 -m pip install build twine + github_release: + name: Create GitHub release + needs: pypi + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v5 - - name: Build a binary wheel and a source tarball - run: python3 -m build --sdist --wheel --outdir dist/ . + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + - name: Create release + env: + GH_TOKEN: ${{ github.token }} + run: gh release create --title ${{ inputs.version }} --target ${{ inputs.branch }} --generate-notes ${{ inputs.version }} --notes-start-tag ${{ inputs.prev_version }} dist/* From 19d9b2f38d0157c653ab9cea7da7dd1a29dbbd23 Mon Sep 17 00:00:00 2001 From: Connor Ward Date: Wed, 21 Oct 2026 16:17:48 +0100 Subject: [PATCH 2/2] fixup --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 1d2a533c..1a936f4d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pyadjoint-ad" +# TODO RELEASE version = "2026.11.0.dev0" dependencies = [ "checkpoint_schedules",