build and release for windows #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release (Windows) | |
| on: | |
| push: | |
| branches: | |
| - linux-release | |
| tags: [ "*" ] | |
| paths: | |
| - 'MarkViewDesktop/**' | |
| workflow_dispatch: | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| # 1) Checkout do repositório | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| # 2) Configurar Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.9" | |
| # 3) Instalar dependências | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r MarkViewDesktop/requirements.txt | |
| pip install pyinstaller | |
| # 4) Build com PyInstaller | |
| - name: Build with PyInstaller | |
| run: | | |
| pyinstaller --noconsole --name "DocViewer.exe" ` | |
| --icon="MarkViewDesktop/icons_svg/doc_icon.ico" ` | |
| --add-data "MarkViewDesktop/ui_docV.py;." ` | |
| --add-data "MarkViewDesktop/icons_svg/*;icons" ` | |
| MarkViewDesktop/main.py | |
| # 5) Compactar o executável (.exe) em zip | |
| - name: Compressing files | |
| run: | | |
| Compress-Archive -Path dist\DocViewer\* -DestinationPath dist\docviewer-windows.zip | |
| dir dist | |
| # 6) Criar ou atualizar uma Release no GitHub | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| with: | |
| tag_name: v0.1.2 | |
| release_name: "Windows Release v0.1.2" | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # 7) Fazer upload do binário gerado na release | |
| - name: Upload to Release | |
| uses: actions/upload-release-asset@v1 | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: dist/docviewer-windows.zip | |
| asset_name: "docviewer-windows.zip" | |
| asset_content_type: application/octet-stream | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |