|
| 1 | +name: Build Executables for Linux, macOS, and Windows |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-linux: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Checkout repository |
| 13 | + uses: actions/checkout@v2 |
| 14 | + |
| 15 | + - name: Set up Python |
| 16 | + uses: actions/setup-python@v2 |
| 17 | + with: |
| 18 | + python-version: 3.x |
| 19 | + |
| 20 | + - name: Install dependencies |
| 21 | + run: | |
| 22 | + python -m pip install --upgrade pip |
| 23 | + pip install -r requirements.txt |
| 24 | +
|
| 25 | + - name: Build Linux executable |
| 26 | + run: | |
| 27 | + pyinstaller --onefile --windowed main.py |
| 28 | + mv dist/main dist/my_app_linux |
| 29 | +
|
| 30 | + - name: Upload Linux executable |
| 31 | + uses: softprops/action-gh-release@v1 |
| 32 | + with: |
| 33 | + files: dist/my_app_linux |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + |
| 37 | + build-macos: |
| 38 | + runs-on: macos-latest |
| 39 | + steps: |
| 40 | + - name: Checkout repository |
| 41 | + uses: actions/checkout@v2 |
| 42 | + |
| 43 | + - name: Set up Python |
| 44 | + uses: actions/setup-python@v2 |
| 45 | + with: |
| 46 | + python-version: 3.x |
| 47 | + |
| 48 | + - name: Install dependencies |
| 49 | + run: | |
| 50 | + python -m pip install --upgrade pip |
| 51 | + pip install -r requirements.txt |
| 52 | +
|
| 53 | + - name: Build macOS executable |
| 54 | + run: | |
| 55 | + pyinstaller --onefile --windowed main.py |
| 56 | + mv dist/main dist/my_app_macos |
| 57 | +
|
| 58 | + - name: Upload macOS executable |
| 59 | + uses: softprops/action-gh-release@v1 |
| 60 | + with: |
| 61 | + files: dist/my_app_macos |
| 62 | + env: |
| 63 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + |
| 65 | + build-windows: |
| 66 | + runs-on: windows-latest |
| 67 | + steps: |
| 68 | + - name: Checkout repository |
| 69 | + uses: actions/checkout@v2 |
| 70 | + |
| 71 | + - name: Set up Python |
| 72 | + uses: actions/setup-python@v2 |
| 73 | + with: |
| 74 | + python-version: 3.x |
| 75 | + |
| 76 | + - name: Install dependencies |
| 77 | + run: | |
| 78 | + python -m pip install --upgrade pip |
| 79 | + pip install -r requirements.txt |
| 80 | +
|
| 81 | + - name: Build Windows executable |
| 82 | + run: | |
| 83 | + pyinstaller --onefile --windowed main.py |
| 84 | + mv dist/main.exe dist/my_app_windows.exe |
| 85 | +
|
| 86 | + - name: Upload Windows executable |
| 87 | + uses: softprops/action-gh-release@v1 |
| 88 | + with: |
| 89 | + files: dist/my_app_windows.exe |
| 90 | + env: |
| 91 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments