-
Notifications
You must be signed in to change notification settings - Fork 1
166 lines (147 loc) · 5.32 KB
/
build-linux-legacy.yml
File metadata and controls
166 lines (147 loc) · 5.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Build and Release (Desktop)
on:
push:
branches:
- linux-release
tags: [ "*" ]
paths:
- 'DocViewerDesktop/**'
workflow_dispatch:
env:
VERSION: ${{ github.ref_type == 'tag' && github.ref_name || format('{0}-dev', github.run_number) }}
jobs:
build-linux:
name: Build Linux
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r DocViewerDesktop/requirements.txt
pip install pyinstaller
- name: Build with PyInstaller (Linux)
run: |
pyinstaller --noconsole --name DocViewer \
--icon="DocViewerDesktop/resources/icons_svg/doc_icon.ico" \
--add-data "DocViewerDesktop/ui/dark-high-v0.qss:ui" \
--add-data "DocViewerDesktop/resources/icons_svg/*:resources/icons_svg" \
--hidden-import="ui.ui_utils" \
--hidden-import="editor.editor_core" \
--hidden-import="editor.actions.file_actions" \
--hidden-import="editor.actions.edit_actions" \
DocViewerDesktop/main.py
- name: Build .deb package
run: |
sudo apt-get update
sudo apt-get install -y ruby ruby-dev build-essential
sudo gem install --no-document fpm
mkdir -p package/opt/docviewer
mkdir -p package/usr/share/applications
mkdir -p package/usr/share/icons/hicolor/256x256/apps
cp -r dist/DocViewer/* package/opt/docviewer/
chmod +x package/opt/docviewer/DocViewer
cp DocViewerDesktop/resources/icons_svg/doc_icon.png \
package/usr/share/icons/hicolor/256x256/apps/docviewer.png
cat <<EOF > package/usr/share/applications/docviewer.desktop
[Desktop Entry]
Type=Application
Name=DocViewer
Exec=/opt/docviewer/DocViewer
Icon=docviewer
Terminal=false
Categories=Utility;Office;
EOF
fpm -s dir -t deb \
-n docviewer \
-v "$VERSION" \
--architecture amd64 \
--depends "libglib2.0-0" \
--depends "libxkbcommon0" \
--depends "libxcb1" \
--depends "libgl1" \
package/
mkdir -p artifacts
mv docviewer_${VERSION}_amd64.deb artifacts/
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: linux-deb
path: artifacts/*.deb
build-windows:
name: Build Windows
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r DocViewerDesktop/requirements.txt
pip install pyinstaller
- name: Build with PyInstaller (Windows)
shell: bash
run: |
pyinstaller --noconsole --name DocViewer \
--icon="DocViewerDesktop/resources/icons_svg/doc_icon.ico" \
--add-data "DocViewerDesktop/ui/dark-high-v0.qss;ui" \
--add-data "DocViewerDesktop/resources/icons_svg/*;resources/icons_svg" \
--hidden-import="ui.ui_utils" \
--hidden-import="editor.editor_core" \
--hidden-import="editor.actions.file_actions" \
--hidden-import="editor.actions.edit_actions" \
DocViewerDesktop/main.py
- name: Zip Windows build
shell: pwsh
run: |
mkdir artifacts
Compress-Archive -Path dist\DocViewer -DestinationPath artifacts\docviewer-windows.zip
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: windows-zip
path: artifacts/docviewer-windows.zip
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [build-linux, build-windows]
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ env.VERSION }}
release_name: "DocViewer ${{ env.VERSION }}"
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Linux .deb
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: linux-deb/docviewer_${{ env.VERSION }}_amd64.deb
asset_name: docviewer-linux.deb
asset_content_type: application/vnd.debian.binary-package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Windows ZIP
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: windows-zip/docviewer-windows.zip
asset_name: docviewer-windows.zip
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}