|
1 |
| -name: Build wheel |
2 |
| - |
| 1 | +name: Build and Upload Python Wheel on Release |
3 | 2 | on:
|
4 |
| - release: |
5 |
| - types: [ 'created', 'edited', 'unpublished' ] |
| 3 | + release: |
| 4 | + types: [released, prereleased ] |
6 | 5 |
|
7 | 6 | env:
|
8 | 7 | CIBW_BUILD_VERBOSITY: 1
|
9 | 8 | VITE_API_ROOT: api
|
| 9 | + NPM_CONFIG_PRODUCTION: false |
10 | 10 |
|
11 | 11 | jobs:
|
12 |
| - build_wheel: |
13 |
| - runs-on: ubuntu-20.04 |
14 |
| - steps: |
15 |
| - - uses: actions/checkout@v2 |
16 |
| - - name: Use Node.js |
17 |
| - uses: actions/setup-node@v3 |
18 |
| - with: |
19 |
| - node-version: v22.1.0 |
20 |
| - - run: npm install |
21 |
| - - run: npm run build |
22 |
| - |
23 |
| - - name: Set up Python |
24 |
| - uses: actions/setup-python@v2 |
25 |
| - with: |
26 |
| - python-version: 3.9 |
27 |
| - |
28 |
| - - name: Build wheel and install |
29 |
| - run: | |
30 |
| - python -m pip install --user --upgrade build |
31 |
| - python -m build --wheel |
32 |
| -
|
33 |
| - - uses: actions/upload-artifact@v4 |
34 |
| - with: |
35 |
| - name: ttnn_visualizer_${{ github.sha }} |
36 |
| - path: ./dist/*.whl |
37 |
| - |
38 |
| - upload-wheel-release: |
39 |
| - runs-on: ubuntu-20.04 |
40 |
| - needs: |
41 |
| - build_wheel |
42 |
| - steps: |
43 |
| - - name: '📦 Upload Release' |
44 |
| - run: | |
45 |
| - cd ${{github.workspace}} |
46 |
| - gh release upload ${{github.event.release.tag_name}} ttnn_visualizer_${{github.sha}} |
47 |
| - env: |
48 |
| - GITHUB_TOKEN: ${{ github.TOKEN }} |
49 |
| - shell: bash |
| 12 | + build: |
| 13 | + name: Build Python Wheel |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout code |
| 18 | + uses: actions/checkout@v3 |
| 19 | + - name: Use Node.js |
| 20 | + uses: actions/setup-node@v3 |
| 21 | + with: |
| 22 | + node-version: v22.1.0 |
| 23 | + - run: npm install |
| 24 | + - run: npm run build |
| 25 | + |
| 26 | + - name: Set up Python |
| 27 | + uses: actions/setup-python@v4 |
| 28 | + with: |
| 29 | + python-version: '3.12.3' |
| 30 | + |
| 31 | + - name: Install build dependencies |
| 32 | + run: | |
| 33 | + python -m pip install --upgrade pip |
| 34 | + pip install build |
| 35 | +
|
| 36 | + - name: Build wheel |
| 37 | + run: | |
| 38 | + python -m build --wheel |
| 39 | +
|
| 40 | + - name: Upload wheel as artifact |
| 41 | + uses: actions/upload-artifact@v3 |
| 42 | + with: |
| 43 | + name: python-wheel |
| 44 | + path: dist/*.whl |
| 45 | + |
| 46 | + release: |
| 47 | + name: Upload Wheel to GitHub Release |
| 48 | + runs-on: ubuntu-latest |
| 49 | + needs: build # Depends on the build job |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Checkout code |
| 53 | + uses: actions/checkout@v3 |
| 54 | + |
| 55 | + - name: Download wheel artifact |
| 56 | + uses: actions/download-artifact@v3 |
| 57 | + with: |
| 58 | + name: python-wheel |
| 59 | + path: /home/runner/work/ttnn-visualizer/ |
| 60 | + - name: get-npm-version |
| 61 | + id: package-version |
| 62 | + uses: martinbeentjes/[email protected] |
| 63 | + |
| 64 | + - name: Get wheel file name |
| 65 | + id: get_wheel |
| 66 | + run: | |
| 67 | + # Find the .whl file and store its name in a variable |
| 68 | + FILE=$(find /home/runner/work/ttnn-visualizer/ -name "*.whl" -type f) |
| 69 | + echo "Found wheel file: $FILE" |
| 70 | + # Set output to the found file name |
| 71 | + echo "wheel_name=$FILE" >> $GITHUB_ENV |
| 72 | +
|
| 73 | + - name: Upload Wheel to Release |
| 74 | + uses: actions/upload-release-asset@v1 |
| 75 | + env: |
| 76 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + with: |
| 78 | + upload_url: ${{ github.event.release.upload_url }} |
| 79 | + asset_path: ${{ env.wheel_name }} |
| 80 | + asset_name: ttnn-visualizer-${{ github.event.release.tag_name }}.whl |
| 81 | + asset_content_type: application/octet-stream |
0 commit comments