-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically package Windows & Mac release on push (#201)
- Loading branch information
1 parent
2014519
commit e5c0f9c
Showing
17 changed files
with
307 additions
and
347 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
curl -fsSL https://git.io/rime-install | bash -s -- prelude essay cantonese emoji-cantonese cangjie stroke luna-pinyin CanCLID/rime-loengfan lotem/rime-octagram-data lotem/rime-octagram-data@hant | ||
|
||
if [ -n "$rime_dir" ]; then | ||
pushd "$rime_dir" | ||
perl -0777 -i -pe 's/\nschema_list:\n.*?\n\n/ | ||
installed_from: rime-cantonese | ||
schema_list: | ||
- schema: jyut6ping3 | ||
- schema: cangjie5 | ||
- schema: stroke | ||
- schema: luna_pinyin | ||
/s; s/page_size: [0-9]+/page_size: 8/' default.yaml | ||
rm emoji_cantonese_suggestion.yaml | ||
popd | ||
fi |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
if [ -z "$SQUIRREL_VERSION" ]; then | ||
echo 'Error: Please specify the Squirrel version to package in the SQUIRREL_VERSION variable' >&2 | ||
exit 1 | ||
fi | ||
if [ -z "$SCHEMA_DIR" ]; then | ||
echo 'Error: Please specify the path to the schema directory in the SCHEMA_DIR variable' >&2 | ||
exit 1 | ||
fi | ||
if [ -z "$APPLE_DEVELOPER_NAME" ] || [ -z "$APPLE_DEVELOPER_TEAM_ID" ] || [ -z "$APPLE_CONNECT_USERNAME" ] || [ -z "$APPLE_CONNECT_PASSWORD" ]; then | ||
echo 'Error: Please specify the APPLE_DEVELOPER_NAME, APPLE_DEVELOPER_TEAM_ID, APPLE_CONNECT_USERNAME, and APPLE_CONNECT_PASSWORD variables for code resigning and notarization' >&2 | ||
exit 1 | ||
fi | ||
set -e | ||
|
||
# Modify the package with the solution from https://stackoverflow.com/a/11299907 | ||
# First, download the package and extract it | ||
wget https://github.com/rime/squirrel/releases/download/${SQUIRREL_VERSION}/Squirrel-${SQUIRREL_VERSION}.pkg | ||
pkgutil --expand Squirrel-${SQUIRREL_VERSION}.pkg package | ||
pushd package | ||
|
||
# Extract the application | ||
cat Payload | gzip -dc | cpio -i@ | ||
pushd Squirrel.app/Contents | ||
|
||
# Remove all default rime schemas but keep opencc data and app config | ||
# Then, download the latest schemas we need and amend the `default.yaml` | ||
GLOBIGNORE=SharedSupport/squirrel.yaml | ||
rm SharedSupport/*.* | ||
cp -rf "$SCHEMA_DIR/"* SharedSupport | ||
popd | ||
|
||
# Resign the application | ||
codesign --sign "Developer ID Application: $APPLE_DEVELOPER_NAME ($APPLE_DEVELOPER_TEAM_ID)" --timestamp --deep --force --options runtime --preserve-metadata=identifier,entitlements Squirrel.app | ||
|
||
# Compress back the application | ||
find Squirrel.app | cpio -o@ | gzip -c > Payload # The `@` flag is *extremely* important to preserve the extended attributes, which contain the signature, of the `rime-install` script | ||
mkbom Squirrel.app Bom | ||
rm -rf Squirrel.app | ||
popd | ||
|
||
# Finally, compress back the package | ||
mkdir output | ||
pkgutil --flatten package output/Squirrel.pkg | ||
cd output | ||
|
||
# Resign the package | ||
pkg_path=Squirrel-${SQUIRREL_VERSION}-rime-cantonese.pkg | ||
productsign --sign "Developer ID Installer: $APPLE_DEVELOPER_NAME ($APPLE_DEVELOPER_TEAM_ID)" Squirrel.pkg "$pkg_path" | ||
|
||
# Notarize the package | ||
xcrun notarytool submit "$pkg_path" --apple-id "$APPLE_CONNECT_USERNAME" --password "$APPLE_CONNECT_PASSWORD" --team-id "$APPLE_DEVELOPER_TEAM_ID" --wait | ||
xcrun stapler staple "$pkg_path" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
if [ -z "$WEASEL_VERSION" ]; then | ||
echo 'Error: Please specify the Weasel version to package in the WEASEL_VERSION variable' >&2 | ||
exit 1 | ||
fi | ||
if [ -z "$SCHEMA_DIR" ]; then | ||
echo 'Error: Please specify the path to the schema directory in the SCHEMA_DIR variable' >&2 | ||
exit 1 | ||
fi | ||
if ! [ -x "$(command -v makensis.exe)" ]; then | ||
echo 'Error: Please specify the path to makensis.exe in the PATH' >&2 | ||
exit 1 | ||
fi | ||
set -e | ||
|
||
# First, download the executable and extract it | ||
wget https://github.com/rime/weasel/releases/download/${WEASEL_VERSION}/weasel-${WEASEL_VERSION}.0-installer.exe --no-check-certificate | ||
7z x weasel-${WEASEL_VERSION}.0-installer.exe -aou -ooutput | ||
cd output | ||
|
||
# List all files with name ending with `_1`, compare the content of these files and the files with the same names but does not end with `_1` whether these binaries is 32-bit or 64-bit | ||
# Then, move the ones that are 32-bit to the `Win32` folder and remove `_1` from the name of all the files | ||
mkdir Win32 | ||
for file in *_1.*; do | ||
extension="${file##*.}" | ||
base_file="${file%_1.*}.$extension" | ||
if [[ $(file "$base_file") != *"x86-64"* ]]; then | ||
mv "$base_file" "Win32/$base_file" | ||
fi | ||
if [[ $(file "$file") == *"x86-64"* ]]; then | ||
mv "$file" "$base_file" | ||
else | ||
mv "$file" "Win32/$base_file" | ||
fi | ||
done | ||
|
||
# Remove all default rime schemas but keep opencc data, preview images and app config | ||
# Then, download the latest schemas we need and amend the `default.yaml` | ||
GLOBIGNORE=data/weasel.yaml | ||
rm data/*.* | ||
cp -rf "$SCHEMA_DIR/"* data | ||
|
||
# Finally, rebuild the installer | ||
mkdir ../resource | ||
wget https://raw.githubusercontent.com/rime/weasel/refs/tags/${WEASEL_VERSION}/resource/weasel.ico -P ../resource | ||
wget https://raw.githubusercontent.com/rime/weasel/refs/tags/${WEASEL_VERSION}/output/install.nsi | ||
mkdir archives | ||
makensis.exe //DWEASEL_VERSION=$WEASEL_VERSION //DPRODUCT_VERSION=$WEASEL_VERSION install.nsi | ||
|
||
# Rename the installer | ||
for file in archives/*.exe; do | ||
mv "$file" "${file/installer/rime-cantonese}" | ||
done |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.