|
| 1 | +name: Build wheels |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, dev, wheel] |
| 6 | + tags: ['*'] |
| 7 | + pull_request: |
| 8 | + branches: [main, dev] |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + build_sdist: |
| 17 | + name: Build & verify package |
| 18 | + runs-on: ubuntu-latest |
| 19 | + permissions: |
| 20 | + attestations: write |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + - uses: hynek/build-and-inspect-python-package@v2 |
| 26 | + with: |
| 27 | + attest-build-provenance-github: ${{ github.event_name != 'pull_request' }} |
| 28 | + skip-wheel: true |
| 29 | + |
| 30 | + build_wheels: |
| 31 | + name: Build wheels on ${{ matrix.os }} |
| 32 | + runs-on: ${{ matrix.os }} |
| 33 | + strategy: |
| 34 | + matrix: |
| 35 | + os: |
| 36 | + - ubuntu-latest |
| 37 | + - ubuntu-24.04-arm |
| 38 | + - windows-latest |
| 39 | + - macos-13 |
| 40 | + - macos-latest |
| 41 | + fail-fast: false |
| 42 | + permissions: |
| 43 | + attestations: write |
| 44 | + |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v4 |
| 47 | + with: |
| 48 | + fetch-depth: 0 |
| 49 | + |
| 50 | + - name: Build wheels |
| 51 | + uses: pypa/cibuildwheel@v2 |
| 52 | + |
| 53 | + - name: Generate artifact attestation for wheels |
| 54 | + if: ${{ github.event_name != 'pull_request' }} |
| 55 | + uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3 |
| 56 | + with: |
| 57 | + subject-path: "wheelhouse/bids_validator_deno-*.whl" |
| 58 | + |
| 59 | + - uses: actions/upload-artifact@v4 |
| 60 | + with: |
| 61 | + name: wheel-${{ matrix.os }} |
| 62 | + path: ./wheelhouse |
| 63 | + |
| 64 | + test-publish: |
| 65 | + name: Push package to test.pypi.org |
| 66 | + # if: github.event_name == 'push' |
| 67 | + runs-on: ubuntu-latest |
| 68 | + needs: [build_sdist, build_wheels] |
| 69 | + # permissions: |
| 70 | + # id-token: write |
| 71 | + |
| 72 | + steps: |
| 73 | + - name: Download sdist |
| 74 | + uses: actions/download-artifact@v4 |
| 75 | + with: |
| 76 | + name: Packages |
| 77 | + path: dist |
| 78 | + |
| 79 | + - name: Download wheels |
| 80 | + uses: actions/download-artifact@v4 |
| 81 | + with: |
| 82 | + name: wheel-* |
| 83 | + path: dist |
| 84 | + |
| 85 | + - run: ls -lR |
| 86 | + |
| 87 | + # - name: Upload package to PyPI |
| 88 | + # uses: pypa/gh-action-pypi-publish@release/v1 |
| 89 | + # with: |
| 90 | + # repository-url: https://test.pypi.org/legacy/ |
| 91 | + # skip-existing: true |
| 92 | + |
| 93 | + publish: |
| 94 | + name: Publish released package to pypi.org |
| 95 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 96 | + runs-on: ubuntu-latest |
| 97 | + needs: [build_sdist, build_wheels] |
| 98 | + permissions: |
| 99 | + id-token: write |
| 100 | + |
| 101 | + steps: |
| 102 | + - name: Download sdist |
| 103 | + uses: actions/download-artifact@v4 |
| 104 | + with: |
| 105 | + name: Packages |
| 106 | + path: dist |
| 107 | + |
| 108 | + - name: Download wheels |
| 109 | + uses: actions/download-artifact@v4 |
| 110 | + with: |
| 111 | + name: wheel-* |
| 112 | + path: dist |
| 113 | + |
| 114 | + - name: Upload package to PyPI |
| 115 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments