diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 0000000..5b15b14 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,61 @@ +name: Build Windows Executable + +on: + push: + branches: [ main, master, develop ] + pull_request: + branches: [ main, master, develop ] + +jobs: + build-windows: + runs-on: windows-latest + + strategy: + matrix: + python-version: ['3.11'] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements_gui.txt + pip install pyinstaller + + - name: Build executable with PyInstaller + run: python build_exe.py + + - name: Upload Windows executable as artifact + uses: actions/upload-artifact@v3 + with: + name: LabelPrinter-Windows + path: dist/LabelPrinter.exe + retention-days: 30 + + - name: Create Release + if: startsWith(github.ref, 'refs/tags/') + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload to Release + if: startsWith(github.ref, 'refs/tags/') + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./dist/LabelPrinter.exe + asset_name: LabelPrinter.exe + asset_content_type: application/octet-stream