{"id":3907,"date":"2023-07-31T15:48:19","date_gmt":"2023-07-31T07:48:19","guid":{"rendered":"https:\/\/h5app.yimenapp.cn\/h5app\/?p=3907"},"modified":"2023-07-31T15:48:19","modified_gmt":"2023-07-31T07:48:19","slug":"github%e5%b7%a5%e7%a8%8b%e6%89%93%e5%8c%85dmg%e6%ad%a5%e9%aa%a4%e4%bb%8b%e7%bb%8d","status":"publish","type":"post","link":"https:\/\/h5app.yimenapp.cn\/h5app\/2023\/ruanjiankf\/3907\/","title":{"rendered":"github\u5de5\u7a0b\u6253\u5305dmg\u6b65\u9aa4\u4ecb\u7ecd"},"content":{"rendered":"<p>\u5f53\u6211\u4eec\u5728 Github \u4e0a\u5f00\u6e90\u4e00\u4e2a Mac \u5e94\u7528\u65f6\uff0c\u901a\u5e38\u9700\u8981\u5c06\u5e94\u7528\u6253\u5305\u6210 dmg \u6587\u4ef6\u8fdb\u884c\u53d1\u5e03\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 Github Act<a href=\"https:\/\/exe.yimenapp.com\/tool-2717.html\">linux\u770b\u56fe\u8f6f\u4ef6<\/a>ions \u81ea\u52a8\u5316\u6253\u5305 dmg \u6587\u4ef6\u3002<\/p>\n<p>## \u539f\u7406<\/p>\n<p>\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.cdn.yimenapp.com\/2023-03\/23\/12\/18235549948.jpg\" \/><\/figure>\n<\/p>\n<p>\u5728 Mac \u4e0a\uff0cdmg \u6587\u4ef6\u662f\u4e00\u79cd\u78c1\u76d8\u6620\u50cf\u6587\u4ef6\uff0c\u53ef\u4ee5\u5c06\u591a\u4e2a\u6587\u4ef6\u6253\u5305\u6210\u4e00\u4e2a\u53ef\u8bfb\u5199\u7684\u78c1\u76d8\u6620\u50cf\u3002\u7528\u6237\u53ef\u4ee5\u5c06 dmg \u6587\u4ef6\u6302\u8f7d\u5230\u7cfb\u7edf\u4e0a\uff0c\u5c31\u50cf\u6302\u8f7d\u4e00\u4e2a\u786c\u76d8\u9a71\u52a8\u5668\u4e00\u6837\u3002\u8fd9\u4f7f\u5f97 dmg \u6587\u4ef6\u6210\u4e3a Mac \u5e94\u7528\u53d1\u5e03\u7684\u5e38\u89c1\u683c\u5f0f\u3002<\/p>\n<p>\u5728 Github \u4e0a\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 Github Actions \u6765\u81ea\u52a8\u5316\u6253\u5305 dmg \u6587\u4ef6\u3002Github Actions \u662f Github \u7684\u4e00\u9879 CI\/CD \u670d\u52a1\uff0c\u53ef\u4ee5\u8ba9\u6211\u4eec\u5728\u4ee3\u7801\u63d0\u4ea4\u65f6\u81ea\u52a8\u8fd0\u884c\u4e00\u4e9b\u4efb\u52a1\uff0c\u4f8b\u5982\u6253\u5305\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>## \u8be6\u7ec6\u4ecb\u7ecd<\/p>\n<p>\u4e0b\u9762\u6211\u4eec\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 Github Actions \u6253\u5305 dmg \u6587\u4ef6\u3002<\/p>\n<p>### \u6b65\u9aa4 1\uff1a\u521b\u5efa Github Actions \u5de5\u4f5c\u6d41\u6587\u4ef6<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5728\u6211\u4eec\u7684 Github \u4ed3\u5e93\u4e2d\u521b\u5efa\u4e00\u4e2a `.github\/workflows` \u76ee\u5f55\uff0c\u5e76\u5728\u5176\u4e2d\u521b\u5efa\u4e00\u4e2a YAML \u6587\u4ef6\uff0c\u4f8b\u5982 `build.yml`\u3002\u8be5\u6587\u4ef6\u5c06\u5b9a\u4e49\u6211\u4eec\u7684 Github Actions \u5de5\u4f5c\u6d41\u3002<\/p>\n<p>&#8220;`yaml<\/p>\n<p>name: Build<\/p>\n<p>on:<\/p>\n<p>  push:<\/p>\n<p>    branches:<\/p>\n<p>      &#8211; master<\/p>\n<p>jobs:<\/p>\n<p>  build:<\/p>\n<p>    runs-on: macos-latest<\/p>\n<p>    steps:<\/p>\n<p>      &#8211; name: Checkout code<\/p>\n<p>        uses: actions\/checkout@v2<\/p>\n<p>      &#8211; name: Install dependencies<\/p>\n<p>        run: |<\/p>\n<p>          sudo gem install cocoapods<\/p>\n<p>          pod install<\/p>\n<p>      &#8211; name: Build app<\/p>\n<p>        run: xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Release -archivePath $PWD\/build\/MyApp.xcarchive archive<\/p>\n<p>      &#8211; name: Create DMG<\/p>\n<p>        uses: jbtule\/codesign-dmg@v1.1.0<\/p>\n<p>        with:<\/p>\n<p>          app: MyApp.app<\/p>\n<p>          volume-name: MyApp<\/p>\n<p>          dmg-name: MyApp.dmg<\/p>\n<p>          codesign-identity: ${{ secrets.CERTIFICATE }}<\/p>\n<p>&#8220;`<\/p>\n<p>\u5728\u8fd9\u4e2a\u5de5\u4f5c\u6d41\u4e2d\uff0c\u6211\u4eec\u5b9a\u4e49\u4e86\u4e00\u4e2a `build` \u4f5c\u4e1a\uff0c\u5b83\u5c06\u5728 `master` \u5206\u652f\u7684\u63a8\u9001\u4e8b\u4ef6\u89e6\u53d1\u65f6\u8fd0\u884c\u3002\u8be5\u4f5c\u4e1a\u5c06\u5728\u6700\u65b0\u7248\u672c\u7684 macOS \u4e0a\u8fd0\u884c\uff0c\u5e76\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p>1. \u68c0\u51fa\u4ee3\u7801\u5e93<\/p>\n<p>2. \u5b89\u88c5\u4f9d\u8d56\u9879<\/p>\n<p>3. \u6784\u5efa\u5e94\u7528\u7a0b\u5e8f<\/p>\n<p>4. \u521b\u5efa dmg \u6587\u4ef6<\/p>\n<p>### \u6b65\u9aa4 2\uff1a\u5b89\u88c5\u4f9d\u8d56\u9879<\/p>\n<p>\u5728\u4e0a\u9762\u7684\u5de5\u4f5c\u6d41\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86 cocoapods \u548c xcodebuild \u5de5\u5177\u6765\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u5728 macOS \u4e0a\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 Homebrew \u5b89\u88c5\u8fd9\u4e9b\u5de5\u5177\uff1a<\/p>\n<p>&#8220;`bash<\/p>\n<p>brew install cocoapods<\/p>\n<p>&#8220;`<\/p>\n<p>### \u6b65\u9aa4 3\uff1a\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f<\/p>\n<p>\u5728\u5de5\u4f5c\u6d41\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528 xcodebuild \u5de5\u5177\u6765\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f\u3002\u6211\u4eec\u9700\u8981\u6307\u5b9a\u5e94\u7528\u7a0b\u5e8f\u7684 workspace\u3001scheme\u3001configuration \u548c archivePath\u3002\u4f8b\u5982\uff1a<\/p>\n<p>&#8220;`bash<\/p>\n<p>xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Release -archivePath $PWD\/build\/MyApp.xcarchive archive<\/p>\n<p>&#8220;`<\/p>\n<p>\u8fd9\u5c06\u751f\u6210\u4e00\u4e2a\u540d\u4e3a `MyApp.xcarchive` \u7684\u6863\u6848\u6587\u4ef6\uff0c\u5176\u4e2d\u5305\u542b\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>### \u6b65\u9aa4 4\uff1a\u521b\u5efa dmg \u6587\u4ef6<\/p>\n<p>\u6700\u540e\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528 jbtule\/codesign-dmg \u5de5\u5177\u6765\u521b\u5efa dmg \u6587\u4ef6\u3002\u8be5\u5de5\u5177\u5c06\u5bf9\u5e94\u7528\u7a0b\u5e8f\u8fdb\u884c\u7b7e\u540d\uff0c\u5e76\u521b\u5efa\u4e00\u4e2a\u53ef\u8bfb\u5199\u7684 dmg \u6587\u4ef6\u3002<\/p>\n<p>&#8220;`yaml<\/p>\n<p>&#8211; name: Create DMG<\/p>\n<p>  uses: jbtule\/codesign-dmg@v1.1.0<\/p>\n<p>  with:<\/p>\n<p>    app: MyApp.app<\/p>\n<p>    volume-name: MyApp<\/p>\n<p>    dmg-name: MyApp.dmg<\/p>\n<p>    codesign-identity: ${{ secrets.CERTIFICATE }}<\/p>\n<p>&#8220;`<\/p>\n<p>\u5728\u8fd9\u4e2a\u6b65\u9aa4\u4e2d\uff0c\u6211\u4eec\u6307\u5b9a\u4e86\u5e94\u7528\u7a0b\u5e8f\u7684<a href=\"https:\/\/exe.yimenapp.com\/tool-3006.html\">\u7f51\u7ad9\u7a0b\u5e8f\u6253\u5305<\/a>\u8def\u5f84\u3001\u5377\u540d\u548c dmg \u6587\u4ef6\u540d\uff0c\u5e76\u4f7f\u7528 secrets.CERTIFICATE \u5bc6\u94a5\u6765\u6307\u5b9a\u7b7e\u540d\u8bc1\u4e66\u3002<\/p>\n<p>## \u7ed3\u8bba<\/p>\n<p>\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528 Github Actions \u81ea\u52a8\u5316\u6253\u5305 dmg \u6587\u4ef6\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 xcodebuild \u5de5\u5177\u6765\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f\uff0c\u5e76\u4f7f\u7528 jbtule\/codesign-dmg \u5de5\u5177\u6765\u521b\u5efa dmg \u6587\u4ef6\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u53ef\u4ee5\u81ea\u52a8\u5316\uff0c\u4f7f\u6211\u4eec\u80fd\u591f\u66f4\u8f7b\u677e\u5730\u53d1\u5e03\u6211\u4eec\u7684 Mac \u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u6211\u4eec\u5728 Github \u4e0a\u5f00\u6e90\u4e00\u4e2a Mac \u5e94\u7528\u65f6\uff0c\u901a\u5e38\u9700\u8981\u5c06\u5e94\u7528\u6253\u5305\u6210 dmg \u6587\u4ef6\u8fdb\u884c\u53d1\u5e03\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528 Github Actions \u81ea\u52a8\u5316\u6253\u5305 dmg \u6587\u4ef6\u3002## \u539f\u7406\u5728 Mac \u4e0a\uff0c<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[7651,7650,7652,11,81],"topic":[],"class_list":["post-3907","post","type-post","status-publish","format-standard","hentry","category-ruanjiankf","tag-flash","tag-htmlexe","tag-7652","tag-11","tag-81"],"_links":{"self":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/3907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/comments?post=3907"}],"version-history":[{"count":0,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/posts\/3907\/revisions"}],"wp:attachment":[{"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/media?parent=3907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/categories?post=3907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/tags?post=3907"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/h5app.yimenapp.cn\/h5app\/wp-json\/wp\/v2\/topic?post=3907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}