diff --git a/.github/workflows/dist.yml b/.github/workflows/dist.yml index fe2a2d73..7051be98 100644 --- a/.github/workflows/dist.yml +++ b/.github/workflows/dist.yml @@ -3,9 +3,16 @@ name: Dist on: push: branches: [ release, next ] - pull_request: - branches: [ release, next ] +# Notes on the Wheels: +# macos-13 is an intel runner, which cibw wants for x86 builds... But intel mac is busted. +# https://github.com/e-dant/watcher/actions/runs/9929111640/job/27426247416#step:3:293 +# We don't support Windows (but we want to) because meson-python doesn't allow us +# to install shared libraries in wheels for Windows. More info and whatnot here: +# https://github.com/mesonbuild/meson-python/discussions/629 +# Other refs, for the action file: +# - https://cibuildwheel.pypa.io/en/stable/setup +# - https://github.com/scikit-image/scikit-image/blob/main/.github/workflows/wheels_recipe.yml jobs: linux-dist: runs-on: ${{matrix.os}} @@ -79,3 +86,110 @@ jobs: with: name: ${{matrix.triple}}.tar.sha256sum path: out/${{matrix.triple}}.tar.sha256sum + wheels-linux: + name: (x86_64|aarch64)-unknown-linux-(gnu|musl) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + with: + platforms: arm64 + - uses: pypa/cibuildwheel@v2.19.2 + with: + package-dir: . + output-dir: wheelhouse + config-file: pyproject.toml + - run: python3 tool/shasum.py wheelhouse show + - run: python3 tool/shasum.py wheelhouse mk + - uses: actions/upload-artifact@v4 + with: + name: wheels-linux + path: wheelhouse/* + wheels-apple: + name: aarch64-apple-darwin + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: pypa/cibuildwheel@v2.19.2 + env: + MACOSX_DEPLOYMENT_TARGET: 11 + with: + package-dir: . + output-dir: wheelhouse + config-file: pyproject.toml + - run: python3 tool/shasum.py wheelhouse show + - run: python3 tool/shasum.py wheelhouse mk + - uses: actions/upload-artifact@v4 + with: + name: wheels-apple + path: wheelhouse/* + create-gh-release: + name: Create GitHub Release + if: ${{ github.ref == 'refs/heads/release' }} + runs-on: ubuntu-latest + needs: + - linux-dist + - apple-dist + - windows-dist + steps: + - uses: actions/checkout@v4 + - run: | + tool/fetch-release-artifacts --no-zip + gh release create "$(cat .version)" --notes "$(tool/show-changelog-for-version)" + gh release upload "$(cat .version)" out/dist/* + env: + GITHUB_TOKEN: ${{ github.token }} + # Ref: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows + publish-wheels-testpypi: + name: Publish Wheels (TestPyPI) + runs-on: ubuntu-latest + needs: + - wheels-apple + - wheels-linux + environment: + name: dist + url: https://test.pypi.org/p/wtr-watcher + permissions: write-all + steps: + - uses: actions/checkout@v4 + with: + token: ${{ github.token }} + - run: | + tool/fetch-release-artifacts --no-zip + mkdir dist + find out/dist -name '*.whl' | while read f + do cp "$f" dist ; echo "$f" + done + env: + GH_TOKEN: ${{ github.token }} + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + verbose: true + publish-wheels-pypi: + name: Publish Wheels + if: ${{ github.ref == 'refs/heads/release' }} + runs-on: ubuntu-latest + needs: + - wheels-apple + - wheels-linux + environment: + name: dist + url: https://pypi.org/p/wtr-watcher + permissions: write-all + steps: + - uses: actions/checkout@v4 + with: + token: ${{ github.token }} + - run: | + tool/fetch-release-artifacts --no-zip + mkdir dist + find out/dist -name '*.whl' | while read f + do cp "$f" dist ; echo "$f" + done + env: + GH_TOKEN: ${{ github.token }} + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://pypi.org/legacy/ + verbose: true diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml deleted file mode 100644 index b68bd368..00000000 --- a/.github/workflows/wheels.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Wheels - -on: - push: - branches: [ release, next ] - pull_request: - branches: [ release, next ] - -# macos-13 is an intel runner, which cibw wants for x86 builds... But intel mac is busted. -# https://github.com/e-dant/watcher/actions/runs/9929111640/job/27426247416#step:3:293 -# We don't support Windows (but we want to) because meson-python doesn't allow us -# to install shared libraries in wheels for Windows. More info and whatnot here: -# https://github.com/mesonbuild/meson-python/discussions/629 -# Other refs, for the action file: -# - https://cibuildwheel.pypa.io/en/stable/setup -# - https://github.com/scikit-image/scikit-image/blob/main/.github/workflows/wheels_recipe.yml -jobs: - wheels-linux: - name: (x86_64|aarch64)-unknown-linux-(gnu|musl) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: docker/setup-qemu-action@v3 - with: - platforms: arm64 - - uses: pypa/cibuildwheel@v2.19.2 - with: - package-dir: . - output-dir: wheelhouse - config-file: pyproject.toml - - run: python3 tool/shasum.py wheelhouse show - - run: python3 tool/shasum.py wheelhouse mk - - uses: actions/upload-artifact@v4 - with: - name: wheels-linux - path: wheelhouse/* - wheels-apple: - name: aarch64-apple-darwin - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: pypa/cibuildwheel@v2.19.2 - env: - MACOSX_DEPLOYMENT_TARGET: 11 - with: - package-dir: . - output-dir: wheelhouse - config-file: pyproject.toml - - run: python3 tool/shasum.py wheelhouse show - - run: python3 tool/shasum.py wheelhouse mk - - uses: actions/upload-artifact@v4 - with: - name: wheels-apple - path: wheelhouse/* diff --git a/pyproject.toml b/pyproject.toml index 19709f84..bd3fd5dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,12 +3,13 @@ build-backend = "mesonpy" requires = ["meson >= 0.61.5", "meson-python >= 0.14.0"] [project] -name = "watcher" -version = "0.12.0" +name = "wtr-watcher" +version = "0.12.1" # hook: tool/release authors = [{name = "Will"}] homepage = "https://github.com/e-dant/watcher" description = "Filesystem watcher. Works anywhere. Simple, efficient, and friendly." -license.text = "MIT" +readme = "readme.md" +license = {file = "license"} keywords = ["watcher", "filesystem", "events", "async"] packages = [{include = "watcher"}] diff --git a/release.yml b/release.yml new file mode 100644 index 00000000..66c89390 --- /dev/null +++ b/release.yml @@ -0,0 +1,40 @@ +name: Release + +on: + workflow_run: + workflows: [ "Wheels" ] + branches: [ next ] + types: + - completed + push: + branches: [ next ] + +jobs: + a: + name: a + runs-on: ubuntu-latest + steps: + - run: echo ok + publish-to-testpypi: + name: Publish Python 🐍 distribution 📦 to TestPyPI + needs: + - wheels-apple + - wheels-linux + # if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + runs-on: ubuntu-latest + environment: + name: testpypi + url: https://test.pypi.org/p/wtr-watcher-runner + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: + - run: | + tool/fetch-release-artifacts --no-zip + mkdir dist + find out/dist -name '*.whl' | while read f + do cp "$f" dist ; echo "$f" + done + - name: Publish distribution 📦 to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ diff --git a/tool/fetch-release-artifacts b/tool/fetch-release-artifacts index 8d3ebf9e..f0285643 100755 --- a/tool/fetch-release-artifacts +++ b/tool/fetch-release-artifacts @@ -1,5 +1,15 @@ #! /usr/bin/env bash set -e +usage() { + cat <