1010 runs-on : macos-latest
1111
1212 steps :
13- - uses : actions/checkout@v2
13+ - uses : actions/checkout@v4
1414
1515 - name : Setup Xcode
1616 uses : maxim-lobanov/setup-xcode@v1
8080 rm dist/MacVimSwitch.app/Contents/MacOS/macvimswitch-arm64
8181 rm dist/MacVimSwitch.app/Contents/MacOS/macvimswitch-x86_64
8282
83- # 创建 Info.plist
83+ - name : Create Info.plist
84+ run : |
8485 cat > dist/MacVimSwitch.app/Contents/Info.plist << 'EOF'
8586 <?xml version="1.0" encoding="UTF-8"?>
8687 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -120,7 +121,8 @@ jobs:
120121 </plist>
121122 EOF
122123
123- # 创建 entitlements.plist
124+ - name : Create Entitlements
125+ run : |
124126 cat > entitlements.plist << 'EOF'
125127 <?xml version="1.0" encoding="UTF-8"?>
126128 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -142,61 +144,39 @@ jobs:
142144 </plist>
143145 EOF
144146
147+ - name : Sign Application
148+ run : |
145149 # 设置执行权限
146150 chmod +x dist/MacVimSwitch.app/Contents/MacOS/macvimswitch
147-
148151 # 使用自签名
149152 codesign --force --deep --sign - --entitlements entitlements.plist dist/MacVimSwitch.app
150153
151- - name : Create DMG with Installation Guide
154+ - name : Create DMG
152155 run : |
153156 # 创建临时挂载点
154157 mkdir -p /tmp/dmg
155-
156158 # 创建应用程序文件夹符号链接
157159 ln -s /Applications /tmp/dmg/Applications
158-
159160 # 复制应用
160161 cp -r dist/MacVimSwitch.app /tmp/dmg/
161-
162162 # 创建 DMG
163163 hdiutil create -volname "MacVimSwitch" -srcfolder /tmp/dmg -ov -format UDZO MacVimSwitch.dmg
164-
165164 # 清理
166165 rm -rf /tmp/dmg
167166
168- - name : Create Release
169- id : create_release
170- uses : actions/create-release@v1
171- env :
172- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
173- with :
174- tag_name : ${{ github.ref }}
175- release_name : Release ${{ github.ref }}
176- draft : false
177- prerelease : false
178-
179- - name : Upload Release Asset
180- uses : actions/upload-release-asset@v1
181- env :
182- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
183- with :
184- upload_url : ${{ steps.create_release.outputs.upload_url }}
185- asset_path : ./MacVimSwitch.dmg
186- asset_name : MacVimSwitch.dmg
187- asset_content_type : application/x-apple-diskimage
167+ - name : Calculate SHA256
168+ run : |
169+ echo "DMG_SHA256=$(shasum -a 256 MacVimSwitch.dmg | cut -d ' ' -f 1)" >> $GITHUB_ENV
188170
189171 - name : Get Tag Message
190172 id : tag
191173 run : |
192- # 获取当前 tag 的注释内容
193- echo "message=$(git tag -l --format='%(contents)' ${{ github.ref_name }})" >> $GITHUB_OUTPUT
174+ tag_message=$(git tag -l --format='%(contents)' ${{ github.ref_name }})
175+ echo "message<<EOF" >> $GITHUB_OUTPUT
176+ echo "$tag_message" >> $GITHUB_OUTPUT
177+ echo "EOF" >> $GITHUB_OUTPUT
194178
195- - name : Calculate SHA256
196- run : |
197- echo "DMG_SHA256=$(shasum -a 256 MacVimSwitch.dmg | cut -d ' ' -f 1)" >> $GITHUB_ENV
198-
199- - name : Add SHA256 to Release
179+ - name : Create Release
200180 uses : softprops/action-gh-release@v1
201181 with :
202182 files : MacVimSwitch.dmg
@@ -220,4 +200,4 @@ jobs:
220200 shasum -a 256 MacVimSwitch.dmg
221201 ```
222202 env :
223- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
203+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments