-
Notifications
You must be signed in to change notification settings - Fork 0
196 lines (170 loc) · 6.04 KB
/
Build&Release.yml
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: Build with PyInstaller and Create Release
on:
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12.3' # specify the Python version you need
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install PyQt5
pip install pywin32
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
python -m pip install --upgrade pip
pip install pyinstaller
pip install PyQt5
- name: Install missing libraries (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
libxcb-shape0-dev \
libxcb-xinerama0 \
libxcb-xkb1 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-icccm4 \
libxcb-render-util0 \
libxkbcommon-x11-0 \
gcc-10 \
g++-10 \
libstdc++6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
sudo update-alternatives --set gcc /usr/bin/gcc-10
sudo update-alternatives --set g++ /usr/bin/g++-10
- name: Extract FFmpeg (Windows)
if: matrix.os == 'windows-latest'
run: |
powershell -command "Expand-Archive -Path 'resources/ffmpeg.zip' -DestinationPath 'resources/'"
- name: List contents of resources directory after extraction (Windows)
if: matrix.os == 'windows-latest'
run: |
Get-ChildItem -Path resources -Recurse
- name: Generate resources_rc.py (Windows)
if: matrix.os == 'windows-latest'
run: |
pyrcc5 resources/resources.qrc -o resources/resources_rc.py
- name: Generate resources_rc.py (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
pyrcc5 resources/resources.qrc -o resources/resources_rc.py
- name: Build with PyInstaller (Windows)
if: matrix.os == 'windows-latest'
run: |
pyinstaller resources/Smelt.spec # Use the spec file
Get-ChildItem -Path dist -Recurse # List contents of dist directory for debugging
Get-ChildItem -Path build -Recurse # List contents of build directory for debugging
- name: Build with PyInstaller (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
pyinstaller resources/Smelt.spec # Use the spec file
ls -al dist # List contents of dist directory for debugging
- name: Set executable permission and create tarball for Linux artifact
if: matrix.os == 'ubuntu-latest'
run: |
chmod +x dist/Smelt
tar -czvf smelt-executable-linux.tar.gz -C dist Smelt
- name: Upload artifact (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v2
with:
name: smelt-executable-windows
path: dist/Smelt.exe # Adjusted path based on build output
- name: Upload artifact (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v2
with:
name: smelt-executable-linux
path: smelt-executable-linux.tar.gz
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download artifact (Windows)
uses: actions/download-artifact@v2
with:
name: smelt-executable-windows
path: ./dist/windows
- name: Download artifact (Linux)
uses: actions/download-artifact@v2
with:
name: smelt-executable-linux
path: ./dist/linux
- name: Check if artifact exists (Linux)
run: |
if [ -f "./dist/linux/smelt-executable-linux.tar.gz" ]; then
echo "Linux artifact found."
else
echo "Linux artifact not found."
exit 1
fi
- name: Get latest release version
id: get_latest_release
run: |
LATEST_VERSION=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
if [[ $LATEST_VERSION == null ]]; then
LATEST_VERSION="v0.0.0"
fi
echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
- name: Set new version
id: set_version
run: |
LATEST_VERSION=${{ env.LATEST_VERSION }}
VERSION_PARTS=(${LATEST_VERSION//./ })
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="v0.$MINOR.$NEW_PATCH"
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.NEW_VERSION }}
release_name: ${{ env.NEW_VERSION }}-Beta Release
body: |
Automatic release from GitHub Actions.
draft: true
prerelease: false
- name: Upload Release Asset (Windows)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/windows/Smelt.exe
asset_name: Smelt.exe
asset_content_type: application/octet-stream
- name: Upload Release Asset (Linux)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/linux/smelt-executable-linux.tar.gz
asset_name: smelt-executable-linux.tar.gz
asset_content_type: application/octet-stream