REL #51
Workflow file for this run
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
| # | |
| # This runs when version tag is pushed | |
| # | |
| name: REL | |
| on: | |
| push: | |
| tags: ["v[0-9]*"] | |
| jobs: | |
| sdist: | |
| name: "Build source package" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: "3.14" | |
| pip-install: -r etc/requirements.build.txt | |
| - run: python3 setup.py sdist | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: {name: "sdist", path: "dist"} | |
| cibuildwheel: | |
| name: "Wheels: ${{matrix.sys.name}} [${{matrix.sys.archs}}]" | |
| runs-on: ${{matrix.sys.os}} | |
| strategy: | |
| matrix: | |
| sys: | |
| - {os: "ubuntu-latest", name: "Linux", archs: "auto"} | |
| - {os: "ubuntu-24.04-arm", name: "Linux", archs: "aarch64"} | |
| - {os: "macos-15-intel", name: "MacOS", archs: "x86_64 universal2"} | |
| - {os: "macos-latest", name: "MacOS", archs: "auto"} | |
| - {os: "windows-latest", name: "Windows", archs: "auto"} | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| - uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 | |
| env: | |
| CIBW_ARCHS: "${{matrix.sys.archs}}" | |
| - name: "Check" | |
| shell: bash | |
| run: | | |
| ls -l wheelhouse | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: {name: "wheel-${{matrix.sys.os}}", path: "wheelhouse"} | |
| dist: | |
| name: "Collect files" | |
| runs-on: ubuntu-latest | |
| needs: [sdist, cibuildwheel] | |
| steps: | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: { path: "dist" } | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: {name: "dist", path: "dist"} | |
| publish-github: | |
| name: "Publish to Github" | |
| runs-on: ubuntu-latest | |
| needs: [dist] | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: "3.14" | |
| pip-install: -r etc/requirements.build.txt | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: {name: "dist", path: "dist"} | |
| - name: "Install pandoc" | |
| run: | | |
| sudo -nH apt-get -u -y install pandoc | |
| pandoc --version | |
| - name: "Prepare" | |
| run: | | |
| ls -l dist | |
| PACKAGE=$(python3 setup.py --name) | |
| VERSION=$(python3 setup.py --version) | |
| TGZ="${PACKAGE}-${VERSION}.tar.gz" | |
| # default - gh:release, pypi | |
| # PRERELEASE - gh:prerelease, pypi | |
| # DRAFT - gh:draft,prerelease, testpypi | |
| PRERELEASE="false"; DRAFT="false" | |
| case "${VERSION}" in | |
| *[ab]*|*rc*) PRERELEASE="true";; | |
| *dev*) PRERELEASE="true"; DRAFT="true";; | |
| esac | |
| test "${{github.ref}}" = "refs/tags/v${VERSION}" || { echo "ERR: tag mismatch"; exit 1; } | |
| test -f "dist/${TGZ}" || { echo "ERR: sdist failed [dist/${TGZ}]"; ls -l dist; exit 1; } | |
| echo "PACKAGE=${PACKAGE}" >> $GITHUB_ENV | |
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
| echo "TGZ=${TGZ}" >> $GITHUB_ENV | |
| echo "PRERELEASE=${PRERELEASE}" >> $GITHUB_ENV | |
| echo "DRAFT=${DRAFT}" >> $GITHUB_ENV | |
| mkdir -p tmp | |
| make -s shownote > tmp/note.md | |
| cat tmp/note.md | |
| ls -l dist | |
| - name: "Create Github release" | |
| env: | |
| GH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| run: | | |
| title="${PACKAGE} v${VERSION}" | |
| ghf="--notes-file=./tmp/note.md" | |
| if test "${DRAFT}" = "true"; then ghf="${ghf} --draft"; fi | |
| if test "${PRERELEASE}" = "true"; then ghf="${ghf} --prerelease"; fi | |
| gh release create "v${VERSION}" --title="${title}" ${ghf} dist/* | |
| publish-pypi: | |
| if: ${{ !contains(github.ref_name, '.dev') }} | |
| name: "Publish to PyPi" | |
| runs-on: ubuntu-latest | |
| needs: [dist] | |
| permissions: | |
| id-token: write | |
| environment: pypi | |
| steps: | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: { name: "dist", path: "dist" } | |
| - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 | |
| publish-testpypi: | |
| if: ${{ contains(github.ref_name, '.dev') }} | |
| name: "Publish to TestPyPi" | |
| runs-on: ubuntu-latest | |
| needs: [dist] | |
| permissions: | |
| id-token: write | |
| environment: testpypi | |
| steps: | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: { name: "dist", path: "dist" } | |
| - uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 | |
| with: { repository-url: "https://test.pypi.org/legacy/" } | |