|
4 | 4 | workflow_call: |
5 | 5 | inputs: |
6 | 6 | registry-name: |
7 | | - description: 'Name of the registry (e.g., pypi, testpypi)' |
| 7 | + description: "Name of the registry (e.g., pypi, testpypi)" |
8 | 8 | required: true |
9 | 9 | type: string |
10 | 10 | registry-url: |
11 | | - description: 'URL of the registry' |
| 11 | + description: "URL of the registry" |
12 | 12 | required: true |
13 | 13 | type: string |
14 | | - package-name: |
15 | | - description: 'Name of the package' |
16 | | - required: true |
17 | | - type: string |
18 | | - python-versions: |
19 | | - description: 'Python versions to build for' |
| 14 | + python-version: |
| 15 | + description: "Python version to build with" |
20 | 16 | required: false |
21 | 17 | type: string |
22 | | - default: | |
23 | | - 3.9 |
24 | | - 3.10 |
25 | | - 3.11 |
26 | | - 3.12 |
27 | | - 3.13 |
28 | | - runner-os: |
29 | | - description: 'Runner operating systems' |
30 | | - required: false |
31 | | - type: string |
32 | | - default: '["ubuntu-latest", "ubuntu-24.04-arm", "macos-13", "macos-latest"]' |
| 18 | + default: "3.11" |
33 | 19 |
|
34 | 20 | jobs: |
35 | | - build_wheels: |
36 | | - name: Build wheels on ${{ matrix.os }} |
37 | | - runs-on: ${{ matrix.os }} |
38 | | - strategy: |
39 | | - matrix: |
40 | | - os: ${{ fromJson(inputs.runner-os) }} |
| 21 | + sdist: |
| 22 | + name: Build source distribution |
| 23 | + runs-on: ubuntu-latest |
41 | 24 |
|
42 | 25 | steps: |
43 | 26 | - uses: actions/checkout@v4 |
44 | 27 | with: |
45 | | - submodules: 'recursive' |
46 | | - |
| 28 | + submodules: "recursive" |
| 29 | + |
47 | 30 | - uses: actions/setup-python@v5 |
48 | 31 | with: |
49 | | - python-version: ${{ inputs.python-versions }} |
50 | | - |
51 | | - - name: Update package name in setup.py and cli |
52 | | - if: ${{ inputs.package-name != 'science-synapse' }} |
53 | | - shell: bash |
54 | | - run: | |
55 | | - if [[ "$RUNNER_OS" == "Linux" ]]; then |
56 | | - if [ -f "setup.py" ]; then |
57 | | - sed -i "s/science-synapse/${{ inputs.package-name }}/g" setup.py |
58 | | - fi |
59 | | - if [ -f "synapse/cli/__main__.py" ]; then |
60 | | - sed -i "s/science-synapse/${{ inputs.package-name }}/g" synapse/cli/__main__.py |
61 | | - fi |
62 | | - else |
63 | | - if [ -f "setup.py" ]; then |
64 | | - sed -i '' "s/science-synapse/${{ inputs.package-name }}/g" setup.py |
65 | | - fi |
66 | | - if [ -f "synapse/cli/__main__.py" ]; then |
67 | | - sed -i '' "s/science-synapse/${{ inputs.package-name }}/g" synapse/cli/__main__.py |
68 | | - fi |
69 | | - fi |
70 | | -
|
71 | | - - name: Install cibuildwheel |
72 | | - run: python -m pip install cibuildwheel==2.22.0 |
| 32 | + python-version: ${{ inputs.python-version }} |
73 | 33 |
|
74 | 34 | - name: Prep repo |
75 | 35 | run: | |
76 | 36 | pip install -r requirements.txt |
77 | 37 | make |
78 | 38 |
|
79 | | - - name: Build wheels |
80 | | - run: python -m cibuildwheel --output-dir wheelhouse |
| 39 | + - name: Build sdist |
| 40 | + run: python -m build --sdist |
81 | 41 |
|
82 | 42 | - uses: actions/upload-artifact@v4 |
83 | 43 | with: |
84 | | - name: cibw-wheels-${{ inputs.package-name }}-${{ matrix.os }}-${{ strategy.job-index }} |
85 | | - path: ./wheelhouse/*.whl |
| 44 | + name: sdist |
| 45 | + path: dist/*.tar.gz |
86 | 46 |
|
87 | 47 | publish: |
88 | | - name: Upload wheels to ${{ inputs.registry-name }} |
89 | | - needs: [build_wheels] |
| 48 | + name: Publish to ${{ inputs.registry-name }} |
| 49 | + needs: [sdist] |
90 | 50 | runs-on: ubuntu-latest |
91 | 51 | environment: |
92 | 52 | name: ${{ inputs.registry-name }} |
93 | | - url: ${{ inputs.registry-url }}${{ inputs.package-name }} |
| 53 | + url: ${{ inputs.registry-url }} |
94 | 54 | permissions: |
95 | 55 | id-token: write |
96 | | - # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
97 | 56 |
|
98 | 57 | steps: |
99 | 58 | - uses: actions/download-artifact@v4 |
100 | 59 | with: |
101 | | - pattern: cibw-wheels-${{ inputs.package-name }}* |
| 60 | + name: sdist |
102 | 61 | path: dist |
103 | | - merge-multiple: true |
104 | 62 |
|
105 | | - - name: List wheels |
| 63 | + - name: List files |
106 | 64 | run: ls -la dist/ |
107 | 65 |
|
108 | 66 | - name: Publish package distributions to ${{ inputs.registry-name }} |
|
0 commit comments