inherit parent's env #238
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
| name: Build | |
| on: [push, pull_request] | |
| jobs: | |
| build_wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: dorny/paths-filter@v2 | |
| id: filter | |
| with: | |
| filters: | | |
| itree: | |
| - 'itree/**' | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4.3.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: python --version | |
| - name: Install cibuildwheel | |
| if: steps.filter.outputs.itree == 'true' | |
| run: | | |
| python -m pip --disable-pip-version-check install cibuildwheel==2.20.0 twine==4.0.2 | |
| - uses: docker/setup-qemu-action@v2 | |
| if: runner.os == 'Linux' | |
| name: Set up QEMU | |
| - name: Build wheels | |
| if: steps.filter.outputs.itree == 'true' | |
| run: | | |
| python -m cibuildwheel --output-dir dist | |
| twine check ./dist/*.whl | |
| - uses: actions/upload-artifact@v3 | |
| if: steps.filter.outputs.itree == 'true' | |
| with: | |
| name: dist | |
| path: ./dist/*.whl | |
| release: | |
| name: create release | |
| needs: [build_wheels] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: dorny/paths-filter@v2 | |
| id: filter | |
| with: | |
| filters: | | |
| itree: | |
| - 'itree/**' | |
| - name: Download artifact | |
| if: steps.filter.outputs.itree == 'true' | |
| uses: actions/download-artifact@v2 | |
| with: | |
| name: dist | |
| path: dist | |
| - name: Release | |
| if: steps.filter.outputs.itree == 'true' | |
| # https://github.com/actions/upload-release-asset/issues/47 | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{secrets.GITHUB_TOKEN}} | |
| script: | | |
| const fs = require('fs').promises; | |
| const { repo: { owner, repo }, sha } = context; | |
| console.log('environment', process.versions); | |
| console.log({ owner, repo, sha }); | |
| const release = await github.repos.createRelease({ | |
| owner, repo, | |
| // if GITHUB_REF just appears to be a branch, use tag-{commit} as the tag | |
| tag_name: process.env.GITHUB_REF.includes("refs/heads/") ? "tag-" + sha : process.env.GITHUB_REF.split("/").pop(), | |
| target_commitish: sha | |
| }); | |
| console.log('created release', { release }); | |
| for (let file of await fs.readdir('dist')) { | |
| console.log('uploading', file); | |
| await github.repos.uploadReleaseAsset({ | |
| owner, repo, | |
| release_id: release.data.id, | |
| name: file, | |
| data: await fs.readFile(`./dist/${file}`) | |
| }); | |
| } | |
| #- name: Publish distribution 📦 to Test PyPI | |
| # if: steps.filter.outputs.itree == 'true' | |
| # uses: pypa/gh-action-pypi-publish@master | |
| # with: | |
| # verbose: true | |
| # skip_existing: true | |
| # verify_metadata: true | |
| # user: __token__ | |
| # password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
| # repository_url: https://test.pypi.org/legacy/ | |
| - name: Publish distribution 📦 to PyPI | |
| #if: steps.filter.outputs.itree == 'true' | |
| uses: pypa/gh-action-pypi-publish@master | |
| with: | |
| verbose: true | |
| skip_existing: true | |
| verify_metadata: true | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| repository_url: https://upload.pypi.org/legacy/ |