Skip to content

Commit cda0701

Browse files
committed
chore: update relesae script
1 parent 6fffaa8 commit cda0701

File tree

3 files changed

+84
-66
lines changed

3 files changed

+84
-66
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -322,14 +322,11 @@ jobs:
322322
runs-on: ${{ matrix.job.os }}
323323
needs: create-release
324324
env:
325-
LINUX_APP_RELEASE_PATH: frontend/appflowy_flutter/product/${{ github.ref_name }}/linux/Release
326-
LINUX_ZIP_NAME: AppFlowy-${{ matrix.job.target }}-x86_64.tar.gz
325+
LINUX_APP_RELEASE_PATH: frontend/appflowy_flutter/build/${{ github.ref_name }}
327326
LINUX_PACKAGE_DEB_NAME: AppFlowy-${{ github.ref_name }}-linux-x86_64.deb
328327
LINUX_PACKAGE_RPM_NAME: AppFlowy-${{ github.ref_name }}-linux-x86_64.rpm
329-
LINUX_PACKAGE_TMP_RPM_NAME: AppFlowy-${{ github.ref_name }}-2.x86_64.rpm
330-
LINUX_PACKAGE_TMP_APPIMAGE_NAME: AppFlowy-${{ github.ref_name }}-x86_64.AppImage
331328
LINUX_PACKAGE_APPIMAGE_NAME: AppFlowy-${{ github.ref_name }}-linux-x86_64.AppImage
332-
LINUX_PACKAGE_ZIP_NAME: AppFlowy-${{ github.ref_name }}-linux-x86_64.tar.gz
329+
LINUX_PACKAGE_ZIP_NAME: AppFlowy-${{ github.ref_name }}-linux-x86_64.zip
333330

334331
strategy:
335332
fail-fast: false
@@ -364,15 +361,22 @@ jobs:
364361
- name: Install prerequisites
365362
working-directory: frontend
366363
run: |
364+
# Install dependencies
367365
sudo wget -qO /etc/apt/trusted.gpg.d/dart_linux_signing_key.asc https://dl-ssl.google.com/linux/linux_signing_key.pub
368366
sudo apt-get update
369-
sudo apt-get install -y build-essential libsqlite3-dev libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev
370-
sudo apt-get install keybinder-3.0
371-
sudo apt-get install -y alien libnotify-dev
372-
sudo apt install rpm patchelf
367+
sudo apt-get install -y build-essential libsqlite3-dev libssl-dev clang cmake ninja-build pkg-config libgtk-3-dev keybinder-3.0 libnotify-dev
368+
sudo apt install rpm patchelf locate
369+
370+
# Install appimagetool
371+
wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
372+
chmod +x appimagetool
373+
mv appimagetool /usr/local/bin/
374+
375+
# Install cargo-make and duckscript
373376
source $HOME/.cargo/env
374377
cargo install --force --locked cargo-make
375378
cargo install --force --locked duckscript_cli
379+
376380
rustup target add ${{ matrix.job.target }}
377381
378382
- name: Install gcc-aarch64-linux-gnu
@@ -386,41 +390,7 @@ jobs:
386390
run: |
387391
flutter config --enable-linux-desktop
388392
dart pub global activate flutter_distributor
389-
dart ./scripts/flutter_release_build/build_flowy.dart run . ${{ github.ref_name }}
390-
391-
- name: Archive Asset
392-
working-directory: ${{ env.LINUX_APP_RELEASE_PATH }}
393-
run: tar -czf ${{ env.LINUX_ZIP_NAME }} *
394-
395-
- name: Build Linux package (.deb)
396-
working-directory: frontend/appflowy_flutter
397-
run: |
398-
flutter_distributor release --name=dev --jobs=release-dev-linux-deb --skip-clean
399-
400-
SOURCE_PATH=build/${{ github.ref_name }}/appflowy-${{ github.ref_name }}+${{ github.ref_name }}-linux.deb
401-
DESTINATION_PATH=../../${{ env.LINUX_APP_RELEASE_PATH }}/${{ env.LINUX_PACKAGE_DEB_NAME }}
402-
cp -r $SOURCE_PATH $DESTINATION_PATH
403-
cd $DESTINATION_PATH
404-
ls -a
405-
406-
- name: Build Linux package (.rpm)
407-
working-directory: frontend/appflowy_flutter
408-
run: |
409-
flutter_distributor release --name=dev --jobs=release-dev-linux-rpm --skip-clean
410-
411-
SOURCE_PATH=build/${{ github.ref_name }}/appflowy-${{ github.ref_name }}+${{ github.ref_name }}-linux.rpm
412-
DESTINATION_PATH=../../${{ env.LINUX_APP_RELEASE_PATH }}/${{ env.LINUX_PACKAGE_RPM_NAME }}
413-
cp -r $SOURCE_PATH $DESTINATION_PATH
414-
cd $DESTINATION_PATH
415-
ls -a
416-
417-
- name: Build Linux package (.AppImage)
418-
working-directory: frontend
419-
continue-on-error: true
420-
run: |
421-
sh scripts/linux_distribution/appimage/build_appimage.sh ${{ github.ref_name }}
422-
cd ..
423-
cp -r frontend/${{ env.LINUX_PACKAGE_TMP_APPIMAGE_NAME }} ${{ env.LINUX_APP_RELEASE_PATH }}/${{ env.LINUX_PACKAGE_APPIMAGE_NAME }}
393+
./scripts/flutter_release_build/build_linux.sh --build_type all --build_arch x86_64 --version ${{ github.ref_name }}
424394
425395
- name: Upload Asset
426396
id: upload-release-asset
@@ -429,11 +399,11 @@ jobs:
429399
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
430400
with:
431401
upload_url: ${{ needs.create-release.outputs.upload_url }}
432-
asset_path: ${{ env.LINUX_APP_RELEASE_PATH }}/${{ env.LINUX_ZIP_NAME }}
402+
asset_path: ${{ env.LINUX_APP_RELEASE_PATH }}/${{ env.LINUX_PACKAGE_ZIP_NAME }}
433403
asset_name: ${{ env.LINUX_PACKAGE_ZIP_NAME }}
434404
asset_content_type: application/octet-stream
435405

436-
- name: Upload Debian package
406+
- name: Upload DEB package
437407
id: upload-release-asset-install-package-deb
438408
uses: actions/upload-release-asset@v1
439409
env:

frontend/scripts/flutter_release_build/build_linux.sh

100644100755
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/bin/bash
12
# This Script is used to build the AppFlowy linux zip, deb, rpm or appimage
23
#
34
# Usage: ./scripts/flutter_release_build/build_linux.sh --build_type <type> --build_arch <arch> --version <version> [--skip-code-generation] [--skip-rebuild-core]
@@ -128,7 +129,7 @@ build_zip() {
128129
cd appflowy_flutter
129130
flutter_distributor release --name=prod --jobs=release-prod-linux-zip --skip-clean
130131
cd ..
131-
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-linux.zip appflowy_flutter/build/$VERSION/appflowy-$VERSION-linux-x86_64.zip
132+
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-linux.zip appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.zip
132133

133134
echo "Zip package built successfully"
134135
}
@@ -141,7 +142,7 @@ build_deb() {
141142
cd appflowy_flutter
142143
flutter_distributor release --name=prod --jobs=release-prod-linux-deb --skip-clean
143144
cd ..
144-
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-linux.deb appflowy_flutter/build/$VERSION/appflowy-$VERSION-linux-x86_64.deb
145+
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-linux.deb appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.deb
145146

146147
echo "Deb package built successfully"
147148
}
@@ -154,7 +155,7 @@ build_rpm() {
154155
cd appflowy_flutter
155156
flutter_distributor release --name=prod --jobs=release-prod-linux-rpm --skip-clean
156157
cd ..
157-
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-linux.rpm appflowy_flutter/build/$VERSION/appflowy-$VERSION-linux-x86_64.rpm
158+
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-linux.rpm appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.rpm
158159

159160
echo "RPM package built successfully"
160161
}
@@ -168,7 +169,7 @@ build_appimage() {
168169
cd appflowy_flutter
169170
flutter_distributor release --name=prod --jobs=release-prod-linux-appimage --skip-clean
170171
cd ..
171-
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-linux.AppImage appflowy_flutter/build/$VERSION/appflowy-$VERSION-linux-x86_64.AppImage
172+
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-linux.AppImage appflowy_flutter/build/$VERSION/AppFlowy-$VERSION-linux-x86_64.AppImage
172173

173174
echo "AppImage package built successfully"
174175
}

frontend/scripts/flutter_release_build/build_macos.sh

Lines changed: 63 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
# --version The version number (e.g. 0.8.2)
1616
# --skip-code-generation Skip the code generation step
1717
# --skip-rebuild-core Skip the core rebuild step
18+
# --apple-id The apple id to use for the notary service
19+
# --team-id The team id to use for the notary service
20+
# --password The password to use for the notary service
1821

1922
show_help() {
2023
echo "Usage: ./scripts/flutter_release_build/build_macos.sh --build_type <type> --build_arch <arch> --version <version> [--skip-code-generation] [--skip-rebuild-core]"
@@ -38,6 +41,9 @@ show_help() {
3841
echo " --version The version number (e.g. 0.8.2)"
3942
echo " --skip-code-generation Skip the code generation step. It may save time if you have already generated the code."
4043
echo " --skip-rebuild-core Skip the core rebuild step. It may save time if you have already built the core."
44+
echo " --apple-id The apple id to use for the notary service"
45+
echo " --team-id The team id to use for the notary service"
46+
echo " --password The password to use for the notary service"
4147
exit 0
4248
}
4349

@@ -69,6 +75,18 @@ while [ $# -gt 0 ]; do
6975
SKIP_REBUILD_CORE=true
7076
shift
7177
;;
78+
--apple-id)
79+
APPLE_ID="$2"
80+
shift 2
81+
;;
82+
--team-id)
83+
TEAM_ID="$2"
84+
shift 2
85+
;;
86+
--password)
87+
PASSWORD="$2"
88+
shift 2
89+
;;
7290
*)
7391
echo "Unknown parameter: $1"
7492
show_help
@@ -100,29 +118,43 @@ if [ "$BUILD_TYPE" != "all" ] && [ "$BUILD_TYPE" != "zip" ] && [ "$BUILD_TYPE" !
100118
exit 1
101119
fi
102120

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+
103134
prepare_build() {
104-
echo "Preparing build..."
135+
info "Preparing build..."
105136

106137
# step 1: build the appflowy-core (rust-lib) based on the build arch
107138
if [ "$SKIP_REBUILD_CORE" != "true" ]; then
108139
if [ "$BUILD_ARCH" = "x86_64" ] || [ "$BUILD_ARCH" = "universal" ]; then
109-
echo "Building appflowy-core for x86_64...(This may take a while)"
140+
info "Building appflowy-core for x86_64...(This may take a while)"
110141
cargo make --profile production-mac-x86_64 appflowy-core-release
111142
fi
112143

113144
if [ "$BUILD_ARCH" = "arm64" ] || [ "$BUILD_ARCH" = "universal" ]; then
114-
echo "Building appflowy-core for arm64...(This may take a while)"
145+
info "Building appflowy-core for arm64...(This may take a while)"
115146
cargo make --profile production-mac-arm64 appflowy-core-release
116147
fi
117148

118149
# step 2 (optional): combine these two libdart_ffi.a into one libdart_ffi.a if the build arch is universal
119150
if [ "$BUILD_ARCH" = "universal" ]; then
120-
echo "Combining libdart_ffi.a for universal..."
151+
info "Combining libdart_ffi.a for universal..."
121152
lipo -create \
122153
rust-lib/target/x86_64-apple-darwin/release/libdart_ffi.a \
123154
rust-lib/target/aarch64-apple-darwin/release/libdart_ffi.a \
124155
-output rust-lib/target/libdart_ffi.a
125156

157+
info "Checking the libdart_ffi.a for universal..."
126158
lipo -archs rust-lib/target/libdart_ffi.a
127159

128160
cp -rf rust-lib/target/libdart_ffi.a \
@@ -132,55 +164,61 @@ prepare_build() {
132164

133165
# step 3 (optional): generate the flutter code: languages, icons and freezed files.
134166
if [ "$SKIP_CODE_GENERATION" != "true" ]; then
135-
echo "Generating the flutter code...(This may take a while)"
167+
info "Generating the flutter code...(This may take a while)"
136168
cargo make code_generation
137169
fi
138170

139171
# step 4: build the zip package
140-
echo "Building the zip package..."
172+
info "Building the zip package..."
141173
cd appflowy_flutter
142174
flutter_distributor release --name=prod --jobs=release-prod-macos-zip --skip-clean
143175
cd ..
144176
}
145177

146178
build_zip() {
147-
echo "Building zip package version $VERSION..."
179+
info "Building zip package version $VERSION..."
148180

149181
# step 1: check if the macos zip package is built, if not, build the zip package
150182
if [ ! -f "appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.zip" ]; then
151-
echo "Macos zip package is not built. Building the zip package..."
183+
info "macOS zip package is not built. Building the zip package..."
152184
prepare_build
153185

154186
# step 1.1: move the zip package to the build directory
155187
mv appflowy_flutter/build/$VERSION/appflowy-$VERSION+$VERSION-macos.zip appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.zip
156188
fi
157189

158190
# step 2: unzip the zip package and codesign the app
159-
unzip appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.zip
191+
unzip -o appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.zip >/dev/null 2>&1
160192

161193
# step 3: codesign the app
162194
# note: You must install the certificate to the system before codesigning
163195
codesign --force --options runtime --deep --sign "Developer ID Application: APPFLOWY PTE. LTD" --deep --verbose AppFlowy.app -v
164196

165197
# step 4: zip the app again
166-
7z a appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.zip AppFlowy.app
198+
7z a appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.zip AppFlowy.app >/dev/null 2>&1
167199

168-
echo "Zip package built successfully"
200+
info "Zip package built successfully"
169201
}
170202

171203
build_dmg() {
172-
echo "Building DMG package version $VERSION..."
204+
info "Building DMG package version $VERSION..."
173205

174206
# step 1: check if the macos zip package is built, if not, build the zip package
175207
if [ ! -f "appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.zip" ]; then
176-
echo "Macos zip package is not built. Building the zip package..."
208+
info "macOS zip package is not built. Building the zip package..."
177209
build_zip
178210
fi
179211

180212
# step 2: unzip the zip package and copy the make_config.json file to the build directory
181-
unzip appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.zip -d appflowy_flutter/build/$VERSION/
213+
unzip appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.zip -d appflowy_flutter/build/$VERSION/ >/dev/null 2>&1
182214
cp appflowy_flutter/macos/packaging/dmg/make_config.json appflowy_flutter/build/$VERSION/
183215

216+
# check if the AppFlowy.app doesn't exist, exit the script
217+
if [ ! -d "appflowy_flutter/build/$VERSION/AppFlowy.app" ]; then
218+
error "AppFlowy.app doesn't exist. Please check the zip package."
219+
exit 1
220+
fi
221+
184222
# step 3: build the dmg package using appdmg
185223
# note: You must install the appdmg to the system before building the dmg package
186224
appdmg appflowy_flutter/build/$VERSION/make_config.json appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.dmg
@@ -189,10 +227,19 @@ build_dmg() {
189227
rm -rf appflowy_flutter/build/$VERSION/AppFlowy.app
190228
rm -rf appflowy_flutter/build/$VERSION/make_config.json
191229

192-
echo "DMG package built successfully. Please use the following command to submit the dmg package to the notary service:"
193-
echo "xcrun notarytool submit appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.dmg --apple-id <your-apple-id> --team-id <your-team-id> --password <your-password> -v -f \"json\" --wait"
230+
info "DMG package built successfully. The dmg package is located at appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.dmg"
231+
232+
if [ -z "$APPLE_ID" ] || [ -z "$TEAM_ID" ] || [ -z "$PASSWORD" ]; then
233+
error "The apple id, team id and password are not specified. Please notarize the dmg package manually."
234+
error "xcrun notarytool submit appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.dmg --apple-id <your-apple-id> --team-id <your-team-id> --password <your-password> -v -f \"json\" --wait"
235+
else
236+
xcrun notarytool submit appflowy_flutter/build/$VERSION/appflowy-$VERSION-macos-$BUILD_ARCH.dmg --apple-id $APPLE_ID --team-id $TEAM_ID --password $PASSWORD -v -f "json" --wait
237+
info "Notarization is completed. Please check the notarization status"
238+
fi
194239
}
195240

241+
clear_cache
242+
196243
# Build packages based on build type
197244
case $BUILD_TYPE in
198245
"all")

0 commit comments

Comments
 (0)