Skip to content

Commit 0640e92

Browse files
committed
feat: support tar.xz package type
1 parent e371ec3 commit 0640e92

File tree

3 files changed

+124
-32
lines changed

3 files changed

+124
-32
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ jobs:
353353
LINUX_PACKAGE_RPM_NAME: AppFlowy-${{ github.ref_name }}-linux-x86_64.rpm
354354
LINUX_PACKAGE_APPIMAGE_NAME: AppFlowy-${{ github.ref_name }}-linux-x86_64.AppImage
355355
LINUX_PACKAGE_ZIP_NAME: AppFlowy-${{ github.ref_name }}-linux-x86_64.zip
356+
LINUX_PACKAGE_TAR_NAME: AppFlowy-${{ github.ref_name }}-linux-x86_64.tar.gz
356357

357358
strategy:
358359
fail-fast: false
@@ -462,6 +463,17 @@ jobs:
462463
asset_name: ${{ env.LINUX_PACKAGE_APPIMAGE_NAME }}
463464
asset_content_type: application/octet-stream
464465

466+
- name: Upload TAR package
467+
id: upload-release-asset-install-package-tar
468+
uses: actions/upload-release-asset@v1
469+
env:
470+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
471+
with:
472+
upload_url: ${{ needs.create-release.outputs.upload_url }}
473+
asset_path: ${{ env.LINUX_APP_RELEASE_PATH }}/${{ env.LINUX_PACKAGE_TAR_NAME }}
474+
asset_name: ${{ env.LINUX_PACKAGE_TAR_NAME }}
475+
asset_content_type: application/octet-stream
476+
465477
build-for-docker:
466478
runs-on: ubuntu-latest
467479
steps:

frontend/scripts/flutter_release_build/build_linux.sh

Lines changed: 64 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# --build_type The type of package to build. Must be one of:
99
# - all: Build all package types
1010
# - zip: Build only zip package
11+
# - tar.xz: Build only tar.xz package
1112
# - deb: Build only deb package
1213
# - rpm: Build only rpm package
1314
# - appimage: Build only appimage package
@@ -28,6 +29,7 @@ show_help() {
2829
echo " --build_type The type of package to build. Must be one of:"
2930
echo " - all: Build all package types"
3031
echo " - zip: Build only zip package"
32+
echo " - tar.xz: Build only tar.xz package"
3133
echo " - deb: Build only deb package"
3234
echo " - rpm: Build only rpm package"
3335
echo " Please install the \033[33mrpm-build\033[0m and \033[33mpatchelf\033[0m before building the rpm and appimage package."
@@ -80,34 +82,47 @@ while [ $# -gt 0 ]; do
8082
esac
8183
done
8284

85+
clear_cache() {
86+
echo "Clearing the cache..."
87+
rm -rf appflowy_flutter/build/$VERSION/
88+
}
89+
90+
info() {
91+
echo "🚀 \033[32m$1\033[0m"
92+
}
93+
94+
error() {
95+
echo "🚨 \033[31m$1\033[0m"
96+
}
97+
8398
# Validate build type argument
8499
if [ -z "$BUILD_TYPE" ]; then
85-
echo "Please specify build type with --build_type: zip, deb, rpm, appimage"
100+
error "Please specify build type with --build_type: all, zip, tar.xz, deb, rpm, appimage"
86101
exit 1
87102
fi
88103

89104
# Validate version argument
90105
if [ -z "$VERSION" ]; then
91-
echo "Please specify version number with --version (e.g. 0.8.2)"
106+
error "Please specify version number with --version (e.g. 0.8.2)"
92107
exit 1
93108
fi
94109

95110
# Validate build arch argument
96111
if [ -z "$BUILD_ARCH" ]; then
97-
echo "Please specify build arch with --build_arch: x86_64, arm64 or universal"
112+
error "Please specify build arch with --build_arch: x86_64, arm64 or universal"
98113
exit 1
99114
fi
100115

101-
if [ "$BUILD_TYPE" != "all" ] && [ "$BUILD_TYPE" != "zip" ] && [ "$BUILD_TYPE" != "deb" ] && [ "$BUILD_TYPE" != "rpm" ] && [ "$BUILD_TYPE" != "appimage" ]; then
102-
echo "Invalid build type. Must be one of: zip, deb, rpm, appimage"
116+
if [ "$BUILD_TYPE" != "all" ] && [ "$BUILD_TYPE" != "zip" ] && [ "$BUILD_TYPE" != "tar.xz" ] && [ "$BUILD_TYPE" != "deb" ] && [ "$BUILD_TYPE" != "rpm" ] && [ "$BUILD_TYPE" != "appimage" ]; then
117+
error "Invalid build type. Must be one of: all, zip, tar.xz, deb, rpm, appimage"
103118
exit 1
104119
fi
105120

106121
has_built_core=false
107122
has_generated_code=false
108123

109124
prepare_build() {
110-
echo "Preparing build..."
125+
info "Preparing build..."
111126

112127
# Build the rust-lib with version
113128
if [ "$SKIP_REBUILD_CORE" != "true" ] && [ "$has_built_core" != "true" ]; then
@@ -122,7 +137,7 @@ prepare_build() {
122137
}
123138

124139
build_zip() {
125-
echo "Building zip package version $VERSION..."
140+
info "Building zip package version $VERSION..."
126141

127142
prepare_build
128143

@@ -131,11 +146,11 @@ build_zip() {
131146
cd ..
132147
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-linux.zip appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.zip
133148

134-
echo "Zip package built successfully"
149+
info "Zip package built successfully. The zip package is located at appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.zip"
135150
}
136151

137152
build_deb() {
138-
echo "Building deb package version $VERSION..."
153+
info "Building deb package version $VERSION..."
139154

140155
prepare_build
141156

@@ -144,11 +159,11 @@ build_deb() {
144159
cd ..
145160
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-linux.deb appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.deb
146161

147-
echo "Deb package built successfully"
162+
info "Deb package built successfully. The deb package is located at appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.deb"
148163
}
149164

150165
build_rpm() {
151-
echo "Building rpm package version $VERSION..."
166+
info "Building rpm package version $VERSION..."
152167

153168
prepare_build
154169

@@ -157,12 +172,12 @@ build_rpm() {
157172
cd ..
158173
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-linux.rpm appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.rpm
159174

160-
echo "RPM package built successfully"
175+
info "RPM package built successfully. The RPM package is located at appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.rpm"
161176
}
162177

163178
# Function to build AppImage package
164179
build_appimage() {
165-
echo "Building AppImage package version $VERSION..."
180+
info "Building AppImage package version $VERSION..."
166181

167182
prepare_build
168183

@@ -171,15 +186,47 @@ build_appimage() {
171186
cd ..
172187
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-linux.AppImage appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.AppImage
173188

174-
echo "AppImage package built successfully"
189+
info "AppImage package built successfully. The AppImage package is located at appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.AppImage"
175190
}
176191

192+
build_tar_xz() {
193+
info "Building tar.xz package version $VERSION..."
194+
195+
prepare_build
196+
197+
# step 1: check if the linux zip package is built, if not, build the zip package
198+
if [ ! -f "appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.zip" ]; then
199+
info "Linux zip package is not built. Building the zip package..."
200+
build_zip
201+
fi
202+
203+
# step 2: unzip the zip package
204+
unzip appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.zip -d appflowy_flutter/build/$VERSION/
205+
206+
# check if the AppFlowy directory exists
207+
if [ ! -d "appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64" ]; then
208+
error "AppFlowy directory doesn't exist. Please check the zip package."
209+
exit 1
210+
fi
211+
212+
# step 3: build the tar.xz package
213+
tar -cJvf appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.tar.xz -C appflowy_flutter/build/$VERSION/ AppFlowy-$VERSION-linux-x86_64
214+
215+
# step 4: clean up the extracted directory
216+
rm -rf appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64
217+
218+
info "Tar.xz package built successfully. The tar.xz package is located at appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.tar.xz"
219+
}
220+
221+
clear_cache
222+
177223
# Build packages based on build type
178224
case $BUILD_TYPE in
179225
"all")
180226
build_zip
181227
build_deb
182228
build_rpm
229+
build_tar_xz
183230
build_appimage
184231
;;
185232
"zip")
@@ -194,4 +241,7 @@ case $BUILD_TYPE in
194241
"appimage")
195242
build_appimage
196243
;;
244+
"tar.xz")
245+
build_tar_xz
246+
;;
197247
esac

frontend/scripts/flutter_release_build/build_macos.sh

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# - all: Build all package types
99
# - zip: Build only zip package
1010
# - dmg: Build only dmg package
11+
# - tar.xz: Build only tar.xz package
1112
# --build_arch The architecture to build. Must be one of:
1213
# - x86_64: Build for x86_64 architecture
1314
# - arm64: Build for arm64 architecture
@@ -31,6 +32,7 @@ show_help() {
3132
echo " - zip: Build only zip package"
3233
echo " Please install the \033[33mp7zip\033[0m before building the zip package."
3334
echo " For more information, please refer to the https://distributor.leanflutter.dev/makers/zip/."
35+
echo " - tar.xz: Build only tar.xz package"
3436
echo " - dmg: Build only dmg package"
3537
echo " Please install the \033[33mappdmg\033[0m before building the dmg package."
3638
echo " For more information, please refer to the https://distributor.leanflutter.dev/makers/dmg/."
@@ -95,42 +97,42 @@ while [ $# -gt 0 ]; do
9597
esac
9698
done
9799

100+
clear_cache() {
101+
echo "Clearing the cache..."
102+
rm -rf appflowy_flutter/build/$VERSION/
103+
}
104+
105+
info() {
106+
echo "🚀 \033[32m$1\033[0m"
107+
}
108+
109+
error() {
110+
echo "🚨 \033[31m$1\033[0m"
111+
}
112+
98113
# Validate build type argument
99114
if [ -z "$BUILD_TYPE" ]; then
100-
echo "Please specify build type with --build_type: zip, dmg"
115+
error "Please specify build type with --build_type: all, zip, dmg, tar.xz"
101116
exit 1
102117
fi
103118

104119
# Validate version argument
105120
if [ -z "$VERSION" ]; then
106-
echo "Please specify version number with --version (e.g. 0.8.2)"
121+
error "Please specify version number with --version (e.g. 0.8.2)"
107122
exit 1
108123
fi
109124

110125
# Validate build arch argument
111126
if [ -z "$BUILD_ARCH" ]; then
112-
echo "Please specify build arch with --build_arch: x86_64, arm64 or universal"
127+
error "Please specify build arch with --build_arch: x86_64, arm64 or universal"
113128
exit 1
114129
fi
115130

116-
if [ "$BUILD_TYPE" != "all" ] && [ "$BUILD_TYPE" != "zip" ] && [ "$BUILD_TYPE" != "dmg" ]; then
117-
echo "Invalid build type. Must be one of: zip, dmg"
131+
if [ "$BUILD_TYPE" != "all" ] && [ "$BUILD_TYPE" != "zip" ] && [ "$BUILD_TYPE" != "dmg" ] && [ "$BUILD_TYPE" != "tar.xz" ]; then
132+
error "Invalid build type. Must be one of: all, zip, dmg, tar.xz"
118133
exit 1
119134
fi
120135

121-
clear_cache() {
122-
echo "Clearing the cache..."
123-
rm -rf appflowy_flutter/build/$VERSION/
124-
}
125-
126-
info() {
127-
echo "🚀 \033[32m$1\033[0m"
128-
}
129-
130-
error() {
131-
echo "🚨 \033[31m$1\033[0m"
132-
}
133-
134136
prepare_build() {
135137
info "Preparing build..."
136138

@@ -250,18 +252,46 @@ build_dmg() {
250252
fi
251253
}
252254

255+
build_tar_xz() {
256+
info "Building tar.xz package version $VERSION..."
257+
258+
# step 1: check if the macos zip package is built, if not, build the zip package
259+
if [ ! -f "appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-macos-$BUILD_ARCH.zip" ]; then
260+
info "macOS zip package is not built. Building the zip package..."
261+
build_zip
262+
fi
263+
264+
# step 2: unzip the zip package and copy the make_config.json file to the build directory
265+
unzip appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-macos-$BUILD_ARCH.zip -d appflowy_flutter/build/$VERSION/
266+
267+
# check if the AppFlowy.app doesn't exist, exit the script
268+
if [ ! -d "appflowy_flutter/build/$VERSION/AppFlowy.app" ]; then
269+
error "AppFlowy.app doesn't exist. Please check the zip package."
270+
exit 1
271+
fi
272+
273+
# step 3: build the tar.xz package
274+
tar -cJvf appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-macos-$BUILD_ARCH.tar.xz appflowy_flutter/build/$VERSION/AppFlowy.app
275+
276+
info "Tar.xz package built successfully. The tar.xz package is located at appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-macos-$BUILD_ARCH.tar.xz"
277+
}
278+
253279
clear_cache
254280

255281
# Build packages based on build type
256282
case $BUILD_TYPE in
257283
"all")
258284
build_zip
259285
build_dmg
286+
build_tar_xz
260287
;;
261288
"zip")
262289
build_zip
263290
;;
264291
"dmg")
265292
build_dmg
266293
;;
294+
"tar.xz")
295+
build_tar_xz
296+
;;
267297
esac

0 commit comments

Comments
 (0)