|
| 1 | +name: On Release |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-win: |
| 9 | + name: Build Windows Installer |
| 10 | + runs-on: windows-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout Code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Set up Python (or any required setup) |
| 17 | + uses: actions/setup-python@v4 |
| 18 | + with: |
| 19 | + python-version: '3.x' # Specify the Python version you need |
| 20 | + cache: 'pip' |
| 21 | + cache-dependency-path: requirements.txt |
| 22 | + - name: Install Dependencies |
| 23 | + run: | |
| 24 | + python -m pip install --upgrade pip |
| 25 | + pip install -r requirements.txt |
| 26 | +
|
| 27 | + - name: Run build step (example) |
| 28 | + run: | |
| 29 | + python setup.py ${{ github.event.release.tag_name }} |
| 30 | + pyinstaller --onefile installer.py |
| 31 | + move dist/installer.exe dist/installer-win.exe |
| 32 | + - name: Upload Artifact |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + with: |
| 35 | + name: installer-win.exe |
| 36 | + path: dist/installer-win.exe |
| 37 | + build-mac: |
| 38 | + name: Build Mac Installer |
| 39 | + runs-on: macos-latest |
| 40 | + |
| 41 | + steps: |
| 42 | + - name: Checkout Code |
| 43 | + uses: actions/checkout@v4 |
| 44 | + |
| 45 | + - name: Set up Python (or any required setup) |
| 46 | + uses: actions/setup-python@v4 |
| 47 | + with: |
| 48 | + python-version: '3.x' # Specify the Python version you need |
| 49 | + cache: 'pip' |
| 50 | + cache-dependency-path: requirements.txt |
| 51 | + - name: Install Dependencies |
| 52 | + run: | |
| 53 | + python -m pip install --upgrade pip |
| 54 | + pip install -r requirements.txt |
| 55 | +
|
| 56 | + - name: Run build step (example) |
| 57 | + run: | |
| 58 | + python setup.py ${{ github.event.release.tag_name }} |
| 59 | + pyinstaller --onefile installer.py |
| 60 | + mv dist/installer dist/installer-mac |
| 61 | + - name: Upload Artifact |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + with: |
| 64 | + name: installer-mac |
| 65 | + path: dist/installer-mac |
| 66 | + append-assets: |
| 67 | + name: Append Assets to Release |
| 68 | + runs-on: ubuntu-latest |
| 69 | + needs: [build-win, build-mac] |
| 70 | + |
| 71 | + steps: |
| 72 | + - name: Checkout Code |
| 73 | + uses: actions/checkout@v4 |
| 74 | + |
| 75 | + - name: Set up Python (or any required setup) |
| 76 | + uses: actions/setup-python@v4 |
| 77 | + with: |
| 78 | + python-version: '3.x' # Specify the Python version you need |
| 79 | + cache: 'pip' |
| 80 | + cache-dependency-path: requirements.txt |
| 81 | + - name: Install Dependencies |
| 82 | + run: | |
| 83 | + python -m pip install --upgrade pip |
| 84 | + pip install -r requirements.txt |
| 85 | +
|
| 86 | + - name: Run build step (example) |
| 87 | + run: | |
| 88 | + python setup.py ${{ github.event.release.tag_name }} |
| 89 | + pyinstaller --onefile installer.py |
| 90 | + mv dist/installer dist/installer-ubuntu |
| 91 | + - name: Download Windows Asset |
| 92 | + uses: actions/download-artifact@v4 |
| 93 | + with: |
| 94 | + name: installer-win.exe |
| 95 | + path: dist/ |
| 96 | + - name: Download Mac Asset |
| 97 | + uses: actions/download-artifact@v4 |
| 98 | + with: |
| 99 | + name: installer-mac |
| 100 | + path: dist/ |
| 101 | + |
| 102 | + - name: Upload Asset to Release |
| 103 | + uses: softprops/action-gh-release@v1 |
| 104 | + with: |
| 105 | + tag_name: ${{ github.event.release.tag_name }} |
| 106 | + files: | |
| 107 | + dist/installer-win.exe |
| 108 | + dist/installer-mac |
| 109 | + dist/installer-ubuntu |
| 110 | +
|
| 111 | + env: |
| 112 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments