build: update action for build dmg file, add repair bash file inside.

This commit is contained in:
Lykin 2024-01-18 21:00:02 +08:00
parent 8948f76f16
commit 06853f7c75
5 changed files with 86 additions and 41 deletions

View File

@ -48,7 +48,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Build frontend assets
shell: bash

View File

@ -54,7 +54,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Build frontend assets
shell: bash
@ -80,29 +80,34 @@ jobs:
# AC_USERNAME: ${{ secrets.AC_USERNAME }}
# AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
- name: Compress macOS app
shell: bash
working-directory: ./build/bin
run: |
mv tinyrdm.app "Tiny RDM.app"
zip -r TinyRDM-${{ steps.normalise_platform.outputs.tag }}.zip "Tiny RDM.app"
- name: Upload release asset (ZIP Package)
shell: bash
working-directory: ./build/bin/
run: |
filepath="TinyRDM-${{ steps.normalise_platform.outputs.tag }}.zip"
filename="TinyRDM_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.zip"
upload_url="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ github.event.release.id }}/assets"
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Content-Type: application/zip" --data-binary @$filepath "$upload_url?name=$filename"
- name: Checkout create-image
uses: actions/checkout@v2
with:
repository: create-dmg/create-dmg
path: ./build/create-dmg
ref: master
- name: Build macOS DMG
shell: bash
working-directory: ./build/bin
working-directory: ./build
run: |
rm TinyRDM-${{ steps.normalise_platform.outputs.tag }}.zip
ln -s /Applications Applications
hdiutil create -volname "Tiny RDM" -srcfolder . -ov -format UDBZ TinyRDM-${{ steps.normalise_platform.outputs.tag }}.dmg
mv bin/tinyrdm.app "bin/Tiny RDM.app"
./create-dmg/create-dmg \
--no-internet-enable \
--volname "Tiny RDM" \
--volicon "bin/Tiny RDM.app/Contents/Resources/iconfile.icns" \
--background "dmg/background.tiff" \
--text-size 12 \
--window-pos 400 400 \
--window-size 660 450 \
--icon-size 80 \
--icon "Tiny RDM.app" 180 180 \
--hide-extension "Tiny RDM.app" \
--app-drop-link 480 180 \
--add-file "Repair" "dmg/fix-app" 430 290 \
--add-file "损坏修复" "dmg/fix-app_zh" 230 290 \
"bin/TinyRDM-${{ steps.normalise_platform.outputs.tag }}.dmg" \
"bin"
- name: Upload release asset (DMG Package)
shell: bash

View File

@ -47,7 +47,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Build frontend assets
shell: bash

40
build/dmg/fix-app Executable file
View File

@ -0,0 +1,40 @@
#!/bin/bash
clear
BLACK="\033[0;30m"
DARK_GRAY="\033[1;30m"
BLUE="\033[0;34m"
LIGHT_BLUE="\033[1;34m"
GREEN="\033[0;32m"
LIGHT_GREEN="\033[1;32m"
CYAN="\033[0;36m"
LIGHT_CYAN="\033[1;36m"
RED="\033[0;31m"
LIGHT_RED="\033[1;31m"
PURPLE="\033[0;35m"
LIGHT_PURPLE="\033[1;35m"
BROWN="\033[0;33m"
YELLOW="\033[0;33m"
LIGHT_GRAY="\033[0;37m"
WHITE="\033[1;37m"
NC="\033[0m"
parentPath=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
cd "$parentPath"
appPath=$( find "$parentPath" -name '*.app' -maxdepth 1)
appName=${appPath##*/}
appBashName=${appName// /\ }
appDIR="/Applications/${appBashName}"
echo -e "This tool fix these situations: \"${appBashName}\" is damaged and can't not be opened."
echo ""
if [ ! -d "$appDIR" ];then
echo ""
echo -e "Execution result: ${RED}You haven't installed ${appBashName} yet, please install it first.${NC}"
else
echo -e "${YELLOW}Please enter your login password, and then press enter. (The password is invisible during input)${NC}"
sudo spctl --master-disable
sudo xattr -rd com.apple.quarantine /Applications/"$appBashName"
sudo xattr -rc /Applications/"$appBashName"
sudo codesign --sign - --force --deep /Applications/"$appBashName"
echo -e "Execution result: ${GREEN}Already fixed! ${NC} ${appBashName} will work correctly.${NC}"
fi
echo -e "You can close this window now"

View File

@ -24,14 +24,14 @@ appPath=$( find "$parentPath" -name '*.app' -maxdepth 1)
appName=${appPath##*/}
appBashName=${appName// /\ }
appDIR="/Applications/${appBashName}"
echo -e "『${appBashName} 已损坏,无法打开/ 来自身份不明的开发者』等问题修复工具"
echo -e "『${appBashName} 提示已损坏,无法打开/ 来自身份不明的开发者』等问题修复工具"
echo ""
#未安装APP时提醒安装已安装绕过公证
# 未安装APP时提醒安装已安装绕过公证
if [ ! -d "$appDIR" ];then
echo ""
echo -e "执行结果:${RED}您还未安装 ${appBashName} ,请先安装${NC}"
else
#绕过公证
# 绕过公证
echo -e "${YELLOW}请输入开机密码,输入完成后按下回车键(输入过程中密码是看不见的)${NC}"
sudo spctl --master-disable
sudo xattr -rd com.apple.quarantine /Applications/"$appBashName"