From 7ee00e27ae60b2cc66c7e90f3d8bcbbbfdc568ef Mon Sep 17 00:00:00 2001 From: jdegenstein Date: Mon, 27 Nov 2023 15:48:17 -0600 Subject: [PATCH] Create publish.yml Initial nonworking draft of structure --- .github/workflows/publish.yml | 80 +++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ab61a31 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,80 @@ +name: Wheel building and publishing + +on: + # schedule: + workflow_dispatch: + push: + pull_request: + +jobs: + test_wheel_building: + # + permissions: + contents: none + uses: someactionyml.yml #TODO: replace with wheel build action + if: (github.event_name == 'push') # || github.event_name == 'pull_request') + with: + upload_to_pypi: false + targets: | + - cp311-manylinux_x86_64 + + secrets: + pypi_token: ${{ secrets.pypi_token }} # consider using alternate strategy + + build_wheel: + # This does the actual wheel building or if triggered manually via the workflow dispatch, or for a tag. + # this job does NOT publish the wheels + permissions: + contents: none + uses: someactionyml.yml #TODO: replace with wheel build action + if: (github.repository == 'gumyr/build123d' && ( startsWith(github.ref, 'refs/tags/v') || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'Build all wheels'))) + with: + # We upload to PyPI for all tags starting with v but not ones ending in .dev + upload_to_pypi: ${{ startsWith(github.ref, 'refs/tags/v') && !endsWith(github.ref, '.dev') && (github.event_name == 'push') }} + # For nightly wheels as well as when building with the 'Build all wheels' label, we disable + # the build isolation + # the latest stable versions of all other build-time dependencies. + env: | + CIBW_BEFORE_BUILD: '${{ ((github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'Build all wheels')) && 'pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple') || '' }}' + CIBW_BUILD_FRONTEND: '${{ ((github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'Build all wheels')) && 'pip; args: --no-build-isolation') || 'build' }}' + targets: | + # Linux wheels + + - cp39-manylinux_x86_64 + - cp310-manylinux_x86_64 + - cp311-manylinux_x86_64 + #- cp312-manylinux_x86_64 + + # MacOS X wheels + + - cp39*macosx_x86_64 + - cp310*macosx_x86_64 + - cp311*macosx_x86_64 + #- cp312*macosx_x86_64 + + - cp39*macosx_arm64 + - cp310*macosx_arm64 + - cp311*macosx_arm64 + #- cp312*macosx_arm64 + + # Windows wheels + + - cp39*win_amd64 + - cp310*win_amd64 + - cp311*win_amd64 + #- cp312*win_amd64 + + pypi-publish: + # this job publishes the wheels built above + name: Upload release to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/build123d + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + # TODO: ? retrieve your distributions here + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1