|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-macos: |
| 13 | + runs-on: macos-latest |
| 14 | + steps: |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Set up Python |
| 19 | + uses: actions/setup-python@v5 |
| 20 | + with: |
| 21 | + python-version: '3.x' |
| 22 | + |
| 23 | + - name: Install PyInstaller |
| 24 | + run: pip install pyinstaller pyserial |
| 25 | + |
| 26 | + - name: Build with PyInstaller |
| 27 | + run: pyinstaller arduino_logique.spec |
| 28 | + |
| 29 | + - name: Compress the build |
| 30 | + run: tar -czvf arduino_logique_macos.tar.gz dist/arduino_logique |
| 31 | + |
| 32 | + - name: Upload artifact |
| 33 | + uses: actions/upload-artifact@v3 |
| 34 | + with: |
| 35 | + name: macos-build |
| 36 | + path: arduino_logique_macos.tar.gz |
| 37 | + |
| 38 | + build-ubuntu: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - name: Checkout code |
| 42 | + uses: actions/checkout@v4 |
| 43 | + |
| 44 | + - name: Set up Python |
| 45 | + uses: actions/setup-python@v5 |
| 46 | + with: |
| 47 | + python-version: '3.x' |
| 48 | + |
| 49 | + - name: Install PyInstaller |
| 50 | + run: pip install pyinstaller pyserial |
| 51 | + |
| 52 | + - name: Build with PyInstaller |
| 53 | + run: pyinstaller arduino_logique.spec |
| 54 | + |
| 55 | + - name: Compress the build |
| 56 | + run: tar -czvf arduino_logique_ubuntu.tar.gz dist/arduino_logique |
| 57 | + |
| 58 | + - name: Upload artifact |
| 59 | + uses: actions/upload-artifact@v3 |
| 60 | + with: |
| 61 | + name: ubuntu-build |
| 62 | + path: arduino_logique_ubuntu.tar.gz |
| 63 | + |
| 64 | + build-windows: |
| 65 | + runs-on: windows-latest |
| 66 | + steps: |
| 67 | + - name: Checkout code |
| 68 | + uses: actions/checkout@v4 |
| 69 | + |
| 70 | + - name: Set up Python |
| 71 | + uses: actions/setup-python@v5 |
| 72 | + with: |
| 73 | + python-version: '3.x' |
| 74 | + |
| 75 | + - name: Install PyInstaller |
| 76 | + run: pip install pyinstaller pyserial |
| 77 | + |
| 78 | + - name: Build with PyInstaller |
| 79 | + run: pyinstaller arduino_logique.spec |
| 80 | + |
| 81 | + - name: Compress the build |
| 82 | + run: Compress-Archive -Path dist\arduino_logique -DestinationPath arduino_logique_windows.zip |
| 83 | + |
| 84 | + - name: Upload artifact |
| 85 | + uses: actions/upload-artifact@v3 |
| 86 | + with: |
| 87 | + name: windows-build |
| 88 | + path: arduino_logique_windows.zip |
| 89 | + |
| 90 | + release: |
| 91 | + needs: [build-macos, build-ubuntu, build-windows] |
| 92 | + runs-on: ubuntu-latest |
| 93 | + permissions: |
| 94 | + contents: write |
| 95 | + steps: |
| 96 | + - name: Checkout code |
| 97 | + uses: actions/checkout@v4 |
| 98 | + with: |
| 99 | + fetch-depth: 0 |
| 100 | + |
| 101 | + - name: Download macOS build |
| 102 | + uses: actions/download-artifact@v3 |
| 103 | + with: |
| 104 | + name: macos-build |
| 105 | + path: ./dist/ |
| 106 | + |
| 107 | + - name: Download Ubuntu build |
| 108 | + uses: actions/download-artifact@v3 |
| 109 | + with: |
| 110 | + name: ubuntu-build |
| 111 | + path: ./dist/ |
| 112 | + |
| 113 | + - name: Download Windows build |
| 114 | + uses: actions/download-artifact@v3 |
| 115 | + with: |
| 116 | + name: windows-build |
| 117 | + path: ./dist/ |
| 118 | + |
| 119 | + - name: Bump version and push tag |
| 120 | + id: bump |
| 121 | + uses: anothrNick/github-tag-action@1.36.0 |
| 122 | + env: |
| 123 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 124 | + WITH_V: true |
| 125 | + RELEASE_BRANCHES: master |
| 126 | + INITIAL_VERSION: v0.0.0 |
| 127 | + |
| 128 | + - name: Create release |
| 129 | + uses: ncipollo/release-action@v1 |
| 130 | + with: |
| 131 | + artifacts: "./dist/arduino_logique_macos.tar.gz,./dist/arduino_logique_ubuntu.tar.gz,./dist/arduino_logique_windows.zip" |
| 132 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 133 | + tag: ${{ steps.bump.outputs.new_tag }} |
0 commit comments