-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (155 loc) · 6.29 KB
/
build.yml
File metadata and controls
178 lines (155 loc) · 6.29 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
167
168
169
170
171
172
173
174
175
176
177
178
name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
build_windows:
description: 'Build Windows x64 executable'
required: true
default: true
type: boolean
build_linux:
description: 'Build Linux x64 deb package'
required: true
default: true
type: boolean
create_release:
description: 'Create GitHub Release'
required: true
default: false
type: boolean
jobs:
build-windows:
runs-on: windows-latest
if: github.event_name != 'workflow_dispatch' || github.event.inputs.build_windows == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install -r requirements.txt
- name: Build Windows executable
run: |
python build.py
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: AssignSticker-windows-x64
path: dist/AssignSticker.exe
build-linux:
runs-on: ubuntu-latest
if: github.event_name != 'workflow_dispatch' || github.event.inputs.build_linux == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install -r requirements.txt
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y dpkg-dev fakeroot
- name: Build Linux executable
run: |
pyinstaller --onefile --windowed --name assignsticker main.py
- name: Prepare DEB package
run: |
mkdir -p release/deb/assignsticker/usr/local/bin
mkdir -p release/deb/assignsticker/usr/share/assignsticker
mkdir -p release/deb/assignsticker/usr/share/applications
mkdir -p release/deb/assignsticker/DEBIAN
# Copy executable
cp dist/assignsticker release/deb/assignsticker/usr/local/bin/
chmod +x release/deb/assignsticker/usr/local/bin/assignsticker
# Copy all project files (excluding unnecessary directories)
for item in icons htmls saying desktop_widgets; do
if [ -d "$item" ]; then
cp -r "$item" release/deb/assignsticker/usr/share/assignsticker/
fi
done
for file in font.ttf icon.ico introduce banner.png LICENSE README.md; do
if [ -f "$file" ]; then
cp "$file" release/deb/assignsticker/usr/share/assignsticker/
fi
done
# Create desktop entry
echo "[Desktop Entry]" > release/deb/assignsticker/usr/share/applications/assignsticker.desktop
echo "Name=AssignSticker" >> release/deb/assignsticker/usr/share/applications/assignsticker.desktop
echo "Comment=Homework Kanban Application" >> release/deb/assignsticker/usr/share/applications/assignsticker.desktop
echo "Exec=/usr/local/bin/assignsticker" >> release/deb/assignsticker/usr/share/applications/assignsticker.desktop
echo "Icon=/usr/share/assignsticker/icon.ico" >> release/deb/assignsticker/usr/share/applications/assignsticker.desktop
echo "Type=Application" >> release/deb/assignsticker/usr/share/applications/assignsticker.desktop
echo "Categories=Education;Office;" >> release/deb/assignsticker/usr/share/applications/assignsticker.desktop
echo "Terminal=false" >> release/deb/assignsticker/usr/share/applications/assignsticker.desktop
# Create control file
echo "Package: assignsticker" > release/deb/assignsticker/DEBIAN/control
echo "Version: 1.3.0" >> release/deb/assignsticker/DEBIAN/control
echo "Section: education" >> release/deb/assignsticker/DEBIAN/control
echo "Priority: optional" >> release/deb/assignsticker/DEBIAN/control
echo "Architecture: amd64" >> release/deb/assignsticker/DEBIAN/control
echo "Depends: python3" >> release/deb/assignsticker/DEBIAN/control
echo "Maintainer: SECTL <sectl@example.com>" >> release/deb/assignsticker/DEBIAN/control
echo "Description: Homework Kanban Application" >> release/deb/assignsticker/DEBIAN/control
echo " AssignSticker is a homework management application" >> release/deb/assignsticker/DEBIAN/control
echo " that helps users organize and track homework tasks." >> release/deb/assignsticker/DEBIAN/control
# Build DEB package
dpkg-deb --build release/deb/assignsticker
mv release/deb/assignsticker.deb release/AssignSticker-linux-amd64.deb
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: AssignSticker-linux-amd64
path: release/AssignSticker-linux-amd64.deb
release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
if: |
always() &&
(github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true') ||
startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download Windows artifact
if: needs.build-windows.result == 'success'
uses: actions/download-artifact@v4
with:
name: AssignSticker-windows-x64
path: artifacts/windows
- name: Download Linux artifact
if: needs.build-linux.result == 'success'
uses: actions/download-artifact@v4
with:
name: AssignSticker-linux-amd64
path: artifacts/linux
- name: Prepare release files
run: |
mkdir -p release_files
if [ -f artifacts/windows/AssignSticker.exe ]; then
mv artifacts/windows/AssignSticker.exe release_files/
fi
if [ -f artifacts/linux/AssignSticker-linux-amd64.deb ]; then
mv artifacts/linux/AssignSticker-linux-amd64.deb release_files/
fi
ls -la release_files/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: release_files/*
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}