|
10 | 10 | workflow_dispatch: |
11 | 11 |
|
12 | 12 | jobs: |
13 | | - build: |
14 | | - name: Build (${{ matrix.os }}) |
15 | | - runs-on: ${{ matrix.os }} |
16 | | - strategy: |
17 | | - fail-fast: false |
18 | | - matrix: |
19 | | - os: [ubuntu-latest, windows-latest] |
| 13 | + build-linux: |
| 14 | + name: Build Linux |
| 15 | + runs-on: ubuntu-latest |
20 | 16 |
|
21 | 17 | steps: |
22 | | - # 1) Checkout |
23 | | - - name: Check out repository |
24 | | - uses: actions/checkout@v4 |
| 18 | + - uses: actions/checkout@v4 |
25 | 19 |
|
26 | | - # 2) Setup Python |
27 | | - - name: Set up Python |
28 | | - uses: actions/setup-python@v4 |
| 20 | + - uses: actions/setup-python@v4 |
29 | 21 | with: |
30 | 22 | python-version: "3.9" |
31 | 23 |
|
32 | | - # 3) Instalar dependências |
33 | 24 | - name: Install dependencies |
34 | 25 | run: | |
35 | 26 | python -m pip install --upgrade pip |
36 | 27 | pip install -r DocViewerDesktop/requirements.txt |
37 | 28 | pip install pyinstaller |
38 | 29 |
|
39 | | - # 4) Build com PyInstaller (configuração por OS) |
40 | | - - name: Build with PyInstaller |
| 30 | + - name: Build with PyInstaller (Linux) |
41 | 31 | run: | |
42 | | - if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then |
43 | | - pyinstaller --noconsole --name DocViewer --onefile \ |
44 | | - --icon="DocViewerDesktop/resources/icons_svg/doc_icon.ico" \ |
45 | | - --add-data "DocViewerDesktop/ui/dark-high-v0.qss:ui" \ |
46 | | - --add-data "DocViewerDesktop/resources/icons_svg/*:resources/icons_svg" \ |
47 | | - --hidden-import="ui.ui_utils" \ |
48 | | - --hidden-import="editor.editor_core" \ |
49 | | - --hidden-import="editor.actions.file_actions" \ |
50 | | - --hidden-import="editor.actions.edit_actions" \ |
51 | | - --exclude-module PySide6.Qt3DCore \ |
52 | | - --exclude-module PySide6.Qt3DRender \ |
53 | | - --exclude-module PySide6.Qt3DExtras \ |
54 | | - --exclude-module PySide6.QtDataVisualization \ |
55 | | - --exclude-module PySide6.QtCharts \ |
56 | | - --exclude-module PySide6.QtWebEngineWidgets \ |
57 | | - DocViewerDesktop/main.py |
58 | | - else |
59 | | - pyinstaller --noconsole --name DocViewer --onefile \ |
60 | | - --icon="DocViewerDesktop/resources/icons_svg/doc_icon.ico" \ |
61 | | - --add-data "DocViewerDesktop/ui/dark-high-v0.qss;ui" \ |
62 | | - --add-data "DocViewerDesktop/resources/icons_svg/*;resources/icons_svg" \ |
63 | | - --hidden-import="ui.ui_utils" \ |
64 | | - --hidden-import="editor.editor_core" \ |
65 | | - --hidden-import="editor.actions.file_actions" \ |
66 | | - --hidden-import="editor.actions.edit_actions" \ |
67 | | - --exclude-module PySide6.Qt3DCore \ |
68 | | - --exclude-module PySide6.Qt3DRender \ |
69 | | - --exclude-module PySide6.Qt3DExtras \ |
70 | | - --exclude-module PySide6.QtDataVisualization \ |
71 | | - --exclude-module PySide6.QtCharts \ |
72 | | - --exclude-module PySide6.QtWebEngineWidgets \ |
73 | | - DocViewerDesktop/main.py |
74 | | - fi |
75 | | - shell: bash |
76 | | - |
77 | | - # 5) Processamento específico para Linux |
78 | | - - name: Linux – Build .deb with FPM |
79 | | - if: matrix.os == 'ubuntu-latest' |
| 32 | + pyinstaller --noconsole --name DocViewer --onefile \ |
| 33 | + --icon="DocViewerDesktop/resources/icons_svg/doc_icon.ico" \ |
| 34 | + --add-data "DocViewerDesktop/ui/dark-high-v0.qss:ui" \ |
| 35 | + --add-data "DocViewerDesktop/resources/icons_svg/*:resources/icons_svg" \ |
| 36 | + --hidden-import="ui.ui_utils" \ |
| 37 | + --hidden-import="editor.editor_core" \ |
| 38 | + --hidden-import="editor.actions.file_actions" \ |
| 39 | + --hidden-import="editor.actions.edit_actions" \ |
| 40 | + DocViewerDesktop/main.py |
| 41 | +
|
| 42 | + - name: Build .deb |
80 | 43 | run: | |
81 | 44 | sudo apt-get update |
82 | 45 | sudo apt-get install -y ruby ruby-dev build-essential |
|
87 | 50 | mkdir -p package/usr/share/icons/hicolor/256x256/apps |
88 | 51 |
|
89 | 52 | cp dist/DocViewer package/usr/local/bin/docviewer |
90 | | - cp DocViewerDesktop/resources/icons_svg/doc_icon.png package/usr/share/icons/hicolor/256x256/apps/docviewer.png |
| 53 | + chmod +x package/usr/local/bin/docviewer |
| 54 | +
|
| 55 | + cp DocViewerDesktop/resources/icons_svg/doc_icon.png \ |
| 56 | + package/usr/share/icons/hicolor/256x256/apps/docviewer.png |
91 | 57 |
|
92 | 58 | cat <<EOF > package/usr/share/applications/docviewer.desktop |
93 | 59 | [Desktop Entry] |
94 | 60 | Type=Application |
95 | 61 | Name=DocViewer |
96 | | - Comment=Visualizador de documentos |
97 | 62 | Exec=/usr/local/bin/docviewer |
98 | 63 | Icon=docviewer |
99 | 64 | Terminal=false |
100 | 65 | Categories=Utility;Office; |
101 | | - StartupNotify=true |
102 | 66 | EOF |
103 | 67 |
|
104 | 68 | fpm -s dir -t deb \ |
105 | 69 | -n docviewer \ |
106 | 70 | -v 1.1.0 \ |
107 | 71 | --architecture amd64 \ |
108 | | - --description "DocViewer Desktop Editor de Documentos" \ |
109 | | - --license "GNU General Public License v3.0" \ |
110 | | - --maintainer "Ernesto Alves <ernesto487dev@gmail.com>" \ |
111 | | - --url "https://github.com/${{ github.repository }}" \ |
112 | 72 | package/ |
113 | 73 |
|
114 | | - mv docviewer_1.1.0_amd64.deb dist/ |
| 74 | + mkdir -p artifacts |
| 75 | + mv docviewer_1.1.0_amd64.deb artifacts/ |
| 76 | +
|
| 77 | + - name: Upload Linux artifact |
| 78 | + uses: actions/upload-artifact@v4 |
| 79 | + with: |
| 80 | + name: linux-deb |
| 81 | + path: artifacts/*.deb |
| 82 | + |
| 83 | + build-windows: |
| 84 | + name: Build Windows |
| 85 | + runs-on: windows-latest |
| 86 | + |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + |
| 90 | + - uses: actions/setup-python@v4 |
| 91 | + with: |
| 92 | + python-version: "3.9" |
| 93 | + |
| 94 | + - name: Install dependencies |
| 95 | + run: | |
| 96 | + python -m pip install --upgrade pip |
| 97 | + pip install -r DocViewerDesktop/requirements.txt |
| 98 | + pip install pyinstaller |
115 | 99 |
|
116 | | - # 6) Processamento específico para Windows |
117 | | - - name: Windows – Zip artifacts |
118 | | - if: matrix.os == 'windows-latest' |
| 100 | + - name: Build with PyInstaller (Windows) |
| 101 | + shell: bash |
119 | 102 | run: | |
120 | | - Compress-Archive -Path dist\DocViewer.exe -DestinationPath dist\docviewer-windows.zip |
| 103 | + pyinstaller --noconsole --name DocViewer --onefile \ |
| 104 | + --icon="DocViewerDesktop/resources/icons_svg/doc_icon.ico" \ |
| 105 | + --add-data "DocViewerDesktop/ui/dark-high-v0.qss;ui" \ |
| 106 | + --add-data "DocViewerDesktop/resources/icons_svg/*;resources/icons_svg" \ |
| 107 | + --hidden-import="ui.ui_utils" \ |
| 108 | + --hidden-import="editor.editor_core" \ |
| 109 | + --hidden-import="editor.actions.file_actions" \ |
| 110 | + --hidden-import="editor.actions.edit_actions" \ |
| 111 | + DocViewerDesktop/main.py |
| 112 | +
|
| 113 | + - name: Zip Windows binary |
121 | 114 | shell: pwsh |
| 115 | + run: | |
| 116 | + mkdir artifacts |
| 117 | + Compress-Archive -Path dist\DocViewer.exe -DestinationPath artifacts\docviewer-windows.zip |
122 | 118 |
|
123 | | - # 7) Criar Release (somente Linux) |
124 | | - - name: Create Release (Linux only) |
125 | | - if: matrix.os == 'ubuntu-latest' |
| 119 | + - name: Upload Windows artifact |
| 120 | + uses: actions/upload-artifact@v4 |
| 121 | + with: |
| 122 | + name: windows-zip |
| 123 | + path: artifacts/docviewer-windows.zip |
| 124 | + |
| 125 | + release: |
| 126 | + name: Create GitHub Release |
| 127 | + runs-on: ubuntu-latest |
| 128 | + needs: [build-linux, build-windows] |
| 129 | + |
| 130 | + steps: |
| 131 | + - name: Download artifacts |
| 132 | + uses: actions/download-artifact@v4 |
| 133 | + |
| 134 | + - name: Create Release |
126 | 135 | id: create_release |
127 | 136 | uses: actions/create-release@v1 |
128 | 137 | with: |
129 | 138 | tag_name: v1.1.0 |
130 | | - release_name: "DocViewer Release v1.1.0" |
| 139 | + release_name: "DocViewer v1.1.0" |
131 | 140 | draft: false |
132 | 141 | prerelease: true |
133 | 142 | env: |
134 | 143 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
135 | 144 |
|
136 | | - # 8) Upload dos artefatos (Linux) |
137 | 145 | - name: Upload Linux .deb |
138 | | - if: matrix.os == 'ubuntu-latest' |
139 | 146 | uses: actions/upload-release-asset@v1 |
140 | 147 | with: |
141 | 148 | upload_url: ${{ steps.create_release.outputs.upload_url }} |
142 | | - asset_path: dist/docviewer_1.1.0_amd64.deb |
143 | | - asset_name: "docviewer-linux.deb" |
| 149 | + asset_path: linux-deb/docviewer_1.1.0_amd64.deb |
| 150 | + asset_name: docviewer-linux.deb |
144 | 151 | asset_content_type: application/vnd.debian.binary-package |
145 | 152 | env: |
146 | 153 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
147 | 154 |
|
148 | | - # 9) Upload do Windows ZIP (usa a release criada pelo Linux) |
149 | 155 | - name: Upload Windows ZIP |
150 | | - if: matrix.os == 'windows-latest' |
151 | 156 | uses: actions/upload-release-asset@v1 |
152 | 157 | with: |
153 | | - # Usa a mesma release criada pelo job Linux |
154 | 158 | upload_url: ${{ steps.create_release.outputs.upload_url }} |
155 | | - asset_path: dist/docviewer-windows.zip |
156 | | - asset_name: "docviewer-windows.zip" |
| 159 | + asset_path: windows-zip/docviewer-windows.zip |
| 160 | + asset_name: docviewer-windows.zip |
157 | 161 | asset_content_type: application/octet-stream |
158 | 162 | env: |
159 | 163 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 164 | + |
| 165 | + |
0 commit comments