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 - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
- name: Build frontend assets - name: Build frontend assets
shell: bash shell: bash

View File

@ -54,7 +54,7 @@ jobs:
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
- name: Build frontend assets - name: Build frontend assets
shell: bash shell: bash
@ -80,29 +80,34 @@ jobs:
# AC_USERNAME: ${{ secrets.AC_USERNAME }} # AC_USERNAME: ${{ secrets.AC_USERNAME }}
# AC_PASSWORD: ${{ secrets.AC_PASSWORD }} # AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
- name: Compress macOS app - name: Checkout create-image
shell: bash uses: actions/checkout@v2
working-directory: ./build/bin with:
run: | repository: create-dmg/create-dmg
mv tinyrdm.app "Tiny RDM.app" path: ./build/create-dmg
zip -r TinyRDM-${{ steps.normalise_platform.outputs.tag }}.zip "Tiny RDM.app" ref: master
- 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: Build macOS DMG - name: Build macOS DMG
shell: bash shell: bash
working-directory: ./build/bin working-directory: ./build
run: | run: |
rm TinyRDM-${{ steps.normalise_platform.outputs.tag }}.zip mv bin/tinyrdm.app "bin/Tiny RDM.app"
ln -s /Applications Applications ./create-dmg/create-dmg \
hdiutil create -volname "Tiny RDM" -srcfolder . -ov -format UDBZ TinyRDM-${{ steps.normalise_platform.outputs.tag }}.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) - name: Upload release asset (DMG Package)
shell: bash shell: bash

View File

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

@ -1,21 +1,21 @@
#!/bin/bash #!/bin/bash
clear clear
BLACK="\033[0;30m" BLACK="\033[0;30m"
DARK_GRAY="\033[1;30m" DARK_GRAY="\033[1;30m"
BLUE="\033[0;34m" BLUE="\033[0;34m"
LIGHT_BLUE="\033[1;34m" LIGHT_BLUE="\033[1;34m"
GREEN="\033[0;32m" GREEN="\033[0;32m"
LIGHT_GREEN="\033[1;32m" LIGHT_GREEN="\033[1;32m"
CYAN="\033[0;36m" CYAN="\033[0;36m"
LIGHT_CYAN="\033[1;36m" LIGHT_CYAN="\033[1;36m"
RED="\033[0;31m" RED="\033[0;31m"
LIGHT_RED="\033[1;31m" LIGHT_RED="\033[1;31m"
PURPLE="\033[0;35m" PURPLE="\033[0;35m"
LIGHT_PURPLE="\033[1;35m" LIGHT_PURPLE="\033[1;35m"
BROWN="\033[0;33m" BROWN="\033[0;33m"
YELLOW="\033[0;33m" YELLOW="\033[0;33m"
LIGHT_GRAY="\033[0;37m" LIGHT_GRAY="\033[0;37m"
WHITE="\033[1;37m" WHITE="\033[1;37m"
NC="\033[0m" NC="\033[0m"
parentPath=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) parentPath=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
@ -24,14 +24,14 @@ appPath=$( find "$parentPath" -name '*.app' -maxdepth 1)
appName=${appPath##*/} appName=${appPath##*/}
appBashName=${appName// /\ } appBashName=${appName// /\ }
appDIR="/Applications/${appBashName}" appDIR="/Applications/${appBashName}"
echo -e "『${appBashName} 已损坏,无法打开/ 来自身份不明的开发者』等问题修复工具" echo -e "『${appBashName} 提示已损坏,无法打开/ 来自身份不明的开发者』等问题修复工具"
echo "" echo ""
#未安装APP时提醒安装已安装绕过公证 # 未安装APP时提醒安装已安装绕过公证
if [ ! -d "$appDIR" ];then if [ ! -d "$appDIR" ];then
echo "" echo ""
echo -e "执行结果:${RED}您还未安装 ${appBashName} ,请先安装${NC}" echo -e "执行结果:${RED}您还未安装 ${appBashName} ,请先安装${NC}"
else else
#绕过公证 # 绕过公证
echo -e "${YELLOW}请输入开机密码,输入完成后按下回车键(输入过程中密码是看不见的)${NC}" echo -e "${YELLOW}请输入开机密码,输入完成后按下回车键(输入过程中密码是看不见的)${NC}"
sudo spctl --master-disable sudo spctl --master-disable
sudo xattr -rd com.apple.quarantine /Applications/"$appBashName" sudo xattr -rd com.apple.quarantine /Applications/"$appBashName"