Skip to content

Commit

Permalink
fix: 修复更新错误的问题 (#39)
Browse files Browse the repository at this point in the history
1. 把.pkg文件压缩放入zip文件中,否则不能正常更新,会报cant extract update
2. 更新appcast.xml加入changelog

Co-authored-by: qwertyyb <qwertyyb@qq.com>
  • Loading branch information
qwertyyb and qwertyyb authored Feb 19, 2021
1 parent abedc1b commit 6ff6f30
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 9 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,22 @@ jobs:
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}

- name: Write Changelog variable
- name: write update url to temp
env:
upload_url: ${{ steps.create_release.outputs.upload_url }}
run: |
mkdir tmp
echo "${upload_url}" > tmp/upload_url
- uses: lifepal/markdown-to-html@v1.2
id: create_html
with:
text: ${{ steps.changelog.outputs.clean_changelog }}

- name: write changelog to temp
env:
changelog_html: ${{ steps.create_html.outputs.html }}
run: echo "$changelog_html" > tmp/changelog_html

- uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -104,10 +114,22 @@ jobs:
apple_id: ${{ secrets.APPLE_ID }}
apple_id_password: ${{ secrets.APPLE_ID_PASSWORD }}
run: ./scripts/c_notarize_installer.sh

- uses: actions/download-artifact@v2
with:
name: tmp
path: ./tmp

- name: load changelog to env
id: load_changelog
run: |
changelog=`cat tmp/changelog_html`
echo "::set-output name=changelog_html::${changelog}"
- name: generate appcast.xml
env:
sparkle_key: ${{ secrets.sparkle_key }}
update_notes: ${{ steps.load_changelog.outputs.changelog_html }}
run: ./scripts/d_build_appcast.sh

- name: gather artifact
Expand Down Expand Up @@ -135,7 +157,7 @@ jobs:
name: tmp
path: ./tmp

- name: 'Load UploadURL'
- name: load update url
id: get_upload_url
run: |
value=`cat tmp/upload_url`
Expand All @@ -151,6 +173,16 @@ jobs:
asset_name: FireInstaller.pkg
asset_content_type: application/octet-stream

- name: Upload Release Asset(installer.zip)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_upload_url.outputs.upload_url }}
asset_path: ./dist/FireInstaller.zip
asset_name: FireInstaller.zip
asset_content_type: application/zip

- name: Upload Release Asset(Fire.zip)
uses: actions/upload-release-asset@v1
env:
Expand Down
4 changes: 2 additions & 2 deletions Fire/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>v0.2.0</string>
<string>v0.3.1</string>
<key>CFBundleURLTypes</key>
<array>
<dict/>
</array>
<key>CFBundleVersion</key>
<string>20210218153556</string>
<string>20210218201831</string>
<key>ComponentInputModeDict</key>
<dict>
<key>tsInputModeListKey</key>
Expand Down
6 changes: 4 additions & 2 deletions package/scripts/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

TARGET='Fire'

pkill -9 "${TARGET}" && rm -rf "/Library/Input\ Methods/${TARGET}.app"

login_user=`/usr/bin/stat -f%Su /dev/console`

/usr/bin/sudo -u "${login_user}" pkill -9 "${TARGET}"
/usr/bin/sudo -u "${login_user}" rm -rf "/Library/Input\ Methods/${TARGET}.app"


/usr/bin/sudo -u "${login_user}" "/Library/Input Methods/${TARGET}.app/Contents/MacOS/${TARGET}" --install

echo "${Target} input method registered and activated successfully"
3 changes: 2 additions & 1 deletion scripts/b_build_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pkgbuild \
--sign "Developer ID Installer: Yongbang Yang" \
"$EXPORT_INSTALLER"

# clean
# pack zip for update
zip "$EXPORT_INSTALLER_ZIP" "$EXPORT_INSTALLER"

rm -rf "${ROOT_DIR}"
1 change: 1 addition & 0 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ EXPORT_ARCHIVE="$EXPORT_PATH/archive.xcarchive"
EXPORT_APP="$EXPORT_PATH/$TARGET.app"
EXPORT_ZIP="$EXPORT_PATH/$TARGET.zip"
EXPORT_INSTALLER="$EXPORT_PATH/FireInstaller.pkg"
EXPORT_INSTALLER_ZIP="$EXPORT_PATH/FireInstaller.zip"

echo "PROJECT_ROOT=$PROJECT_ROOT"
8 changes: 6 additions & 2 deletions scripts/d_build_appcast.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ then
exit 1
fi

download_url='https://github.com/qwertyyb/Fire/releases/latest/download/FireInstaller.pkg'
download_url='https://github.com/qwertyyb/Fire/releases/latest/download/FireInstaller.zip'

version=$(git describe --tags `git rev-list --tags --max-count=1`)

str=$($PROJECT_ROOT/Pods/Sparkle/bin/sign_update -s "${sparkle_key}" "$EXPORT_INSTALLER")
str=$($PROJECT_ROOT/Pods/Sparkle/bin/sign_update -s "${sparkle_key}" "$EXPORT_INSTALLER_ZIP")

sign=$(echo $str | grep "edSignature=\"[^\"]*" -o | grep "\"[^\"]*" -o)
sign=${sign#\"}
Expand Down Expand Up @@ -45,6 +45,10 @@ cat>$EXPORT_PATH/appcast.xml<<EOF
<title>${version}</title>
<pubDate>$(date -R)</pubDate>
<sparkle:minimumSystemVersion>10.15</sparkle:minimumSystemVersion>
<description><![CDATA[
${update_notes}
]]>
</description>
<enclosure url="${download_url}"
sparkle:version="${CFBundleVersion}"
sparkle:shortVersionString="${version}"
Expand Down

0 comments on commit 6ff6f30

Please sign in to comment.