-
-
Notifications
You must be signed in to change notification settings - Fork 41
executable file
·292 lines (240 loc) · 10.4 KB
/
build-macos-release.yaml
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
name: Build and Release Converseen for MacOS
on:
push:
tags:
- '**'
workflow_dispatch:
permissions:
contents: write
jobs:
build_converseen_macos:
name: Build MacOS Deps
runs-on: macos-12
outputs:
output_version: ${{ steps.set-env.outputs.ver }}
env:
BASE_DIR: ${{ github.workspace }}/im_build
WORKING_DIR: ${{ github.workspace }}
steps:
- name: Install dependencies
run: |
set -e
export HOMEBREW_NO_AUTO_UPDATE=1
brew install pkg-config freetype jpeg-turbo libheif libpng libtiff libtool openexr openexr openjpeg webp libraw ghostscript
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: '6.7.*'
host: 'mac'
target: 'desktop'
arch: 'clang_64'
- name: Checkout Converseen
uses: actions/checkout@v4
with:
path: converseen
- name: Set Environment
id: set-env
run: |
file_content=$(tr -d '\r' <converseen/package/macOS/version.txt)
VERSION=$(echo "$file_content" | grep -oE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+')
BUILD=$(echo "$file_content" | grep -oE '[0-9]+$')
export LIB_DIR="${BASE_DIR}/lib"
export LOCAL_LIB="/usr/local/lib"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "BUILD=$BUILD" >> $GITHUB_ENV
echo "LIB_DIR=$LIB_DIR" >> $GITHUB_ENV
echo "LOCAL_LIB=$LOCAL_LIB" >> $GITHUB_ENV
echo "ver=$VERSION" >> "$GITHUB_OUTPUT"
echo "Version: $VERSION"
echo "Build Number: $BUILD"
- name: Download ImageMagick
run: |
wget https://imagemagick.org/archive/ImageMagick.tar.gz
tar -xzvf ImageMagick.tar.gz
- name: Build ImageMagick
run: |
cd ImageMagick-*
./configure --prefix=${{ github.workspace }}/im_build \
--with-quantum-depth=16 \
--disable-dependency-tracking \
--without-perl \
--without-x \
--disable-static \
--disable-installed \
--enable-shared \
--with-flif=yes \
--with-gslib=yes
make
make install
- name: Build Converseen
run: |
mkdir build
cd build
qmake ../converseen/converseen.pro -spec macx-clang QMAKE_MACOSX_DEPLOYMENT_TARGET=11.0 IM_INSTALL_PREFIX=${{ github.workspace }}/im_build
make
- name: Copy Dependencies
shell: python {0}
run: |
import os
import shutil
working_dir = os.environ['WORKING_DIR']
os.chdir(working_dir + "/build/bin")
print("Working dir:" + working_dir + "/build/bin")
# Define the destination folder where symbolic links will be copied
destination_folder = "converseen.app/Contents/Frameworks"
os.mkdir(destination_folder)
# Define the folders to scan
folders_to_scan = [
"/usr/local/Cellar/aom",
"/usr/local/Cellar/brotli",
"/usr/local/Cellar/fontconfig",
"/usr/local/Cellar/freetype",
"/usr/local/Cellar/gettext",
"/usr/local/Cellar/ghostscript",
"/usr/local/Cellar/giflib",
"/usr/local/Cellar/highway",
"/usr/local/Cellar/imath",
"/usr/local/Cellar/jasper",
"/usr/local/Cellar/jbig2dec",
"/usr/local/Cellar/jpeg-turbo",
"/usr/local/Cellar/jpeg-xl",
"/usr/local/Cellar/libde265",
"/usr/local/Cellar/libheif",
"/usr/local/Cellar/libidn",
"/usr/local/Cellar/libomp",
"/usr/local/Cellar/libpng",
"/usr/local/Cellar/libraw",
"/usr/local/Cellar/libtiff",
"/usr/local/Cellar/libtool",
"/usr/local/Cellar/libvmaf",
"/usr/local/Cellar/little-cms2",
"/usr/local/Cellar/lz4",
"/usr/local/Cellar/openexr",
"/usr/local/Cellar/openjpeg",
"/usr/local/Cellar/pcre2",
"/usr/local/Cellar/webp",
"/usr/local/Cellar/x265",
"/usr/local/Cellar/xz",
"/usr/local/Cellar/zstd"
]
# Function to find and copy symbolic links with a dylib extension
def copy_dylib_from_folder(folder):
try:
if os.path.exists(folder):
for root, dirs, files in os.walk(folder):
for file in files:
if file.endswith(".dylib"):
dylib_path = os.path.join(root, file)
dylib_name = os.path.basename(dylib_path)
if os.path.islink(os.path.join(root, file)):
# Copy the symbolic link to the destination folder
shutil.copy(dylib_path, os.path.join(destination_folder, dylib_name), follow_symlinks=False)
print(f"Copied link {dylib_name} from {folder} to {destination_folder}")
else:
# Copy library to the destination folder
shutil.copy(dylib_path, os.path.join(destination_folder, dylib_name))
print(f"Copied file {dylib_name} from {folder} to {destination_folder}")
else:
print(f"The folder {folder} does not exist.")
except Exception as e:
print(f"An error occurred: {str(e)} while copying from {folder}")
# Execute the function for each folder to scan
for folder in folders_to_scan:
copy_dylib_from_folder(folder)
- name: Deploy Qt
run: |
cd build/bin
sudo chmod -Rv a+rwx converseen.app/Contents/Frameworks/
macdeployqt converseen.app -libpath=${{ github.workspace }}/im_build/lib
# Fix libzip rpaths
cd converseen.app/Contents/Frameworks/
install_name_tool -change /usr/lib/libbz2.1.0.dylib @rpath/libbz2.1.0.dylib libzip.5.dylib
install_name_tool -change @loader_path/../../../../opt/xz/lib/liblzma.5.dylib @rpath/liblzma.5.dylib libzip.5.dylib
install_name_tool -change @loader_path/../../../../opt/zstd/lib/libzstd.1.dylib @rpath/libzstd.1.dylib libzip.5.dylib
- name: Copy Resources
run: |
cd build/bin
gs_ver=$(echo $(ls /usr/local/Cellar/ghostscript/) | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
echo "--- Copying res files ---"
cp -rvf ${{ github.workspace }}/im_build/etc/ImageMagick-7 converseen.app/Contents/Resources
cp -rvf /usr/local/Cellar/ghostscript/$gs_ver/share/ghostscript converseen.app/Contents/Resources
echo "--- Copying loc files ---"
mkdir converseen.app/Contents/Resources/loc
cp -rvf ../../converseen/loc/*.qm converseen.app/Contents/Resources/loc
echo "--- Rename Ghostscript Resource Dir ---"
cd converseen.app/Contents/Resources/ghostscript
# gs_ver=$(echo $(ls) | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
mv $gs_ver gs
- name: Compress Converseen
run: |
cd build/bin
zip -r --symlinks -9 converseen-${{ env.VERSION }}-${{ env.BUILD }}_beta_macos-x86_64.zip converseen.app
pwd
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ConverseenMacOSIntel
path: build/bin/converseen-${{ env.VERSION }}-${{ env.BUILD }}_beta_macos-x86_64.zip
create_release:
name: 'Create Release'
needs:
- build_converseen_macos
runs-on: ubuntu-latest
steps:
- name: Checkout Converseen
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ConverseenMacOSIntel
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: "v${{ needs.build_converseen_macos.outputs.output_version }}"
- name: Publish Release
uses: softprops/action-gh-release@v1
with:
tag_name: "${{ steps.previoustag.outputs.tag }}"
files: |
*macos-x86_64.zip
sf-release:
name: Sourceforge Release
needs:
- build_converseen_macos
runs-on: ubuntu-latest
steps:
- name: Known Hosts
id: known-hosts
run: |
SF_HOSTS=$(ssh-keyscan -H frs.sourceforge.net)
echo "known-hosts=$SF_HOSTS" >> $GITHUB_OUTPUT
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ConverseenMacOSIntel
path: artifacts
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SF_SSH_KEY }}
known_hosts: ${{ steps.known-hosts.outputs.known-hosts }}
if_key_exists: fail # replace / ignore / fail; optional (defaults to fail)
- name: rsync over SSH
id: rsync
run: |
cd artifacts
c_ver=${{ needs.build_converseen_macos.outputs.output_version }}
v_dir=$(echo "$c_ver" | grep -oE '^[0-9]+\.[0-9]+')
c_target=$(echo $(ls converseen-*macos-x86_64.zip))
echo "target-file=$c_target" >> $GITHUB_OUTPUT
rsync -r *.zip* ${{ secrets.SF_USERHOST }}:"${{ secrets.SF_PATH }}/Converseen $v_dir/"
- name: Set Platform
run: |
c_ver=${{ needs.build_converseen_macos.outputs.output_version }}
c_target=${{ steps.rsync.outputs.target-file }}
v_dir=$(echo "$c_ver" | grep -oE '^[0-9]+\.[0-9]+')
c_url=https://sourceforge.net/projects/converseen/files/Converseen/Converseen%20${v_dir}/$c_target
echo "url: $c_url"
curl -H "Accept: application/json" -X PUT -d "default=mac" -d "api_key=${{ secrets.SF_API_KEY }}" $c_url