<script type="application/ld+json">{"@context":"http://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://www.simcentric.com/tc/"},{"@type":"ListItem","position":2,"name":"如何使用 GitHub 將程式碼部署到你的伺服器","item":"https://www.simcentric.com/tc/hong-kong-dedicated-server-tc/how-to-deploy-code-using-github-to-your-server/"}]}</script> {"id":31781,"date":"2026-04-30T11:14:13","date_gmt":"2026-04-30T03:14:13","guid":{"rendered":"https:\/\/www.simcentric.com\/uncategorized-tc\/how-to-deploy-code-using-github-to-your-server\/"},"modified":"2026-04-30T11:18:07","modified_gmt":"2026-04-30T03:18:07","slug":"how-to-deploy-code-using-github-to-your-server","status":"publish","type":"post","link":"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 GitHub \u5c07\u7a0b\u5f0f\u78bc\u90e8\u7f72\u5230\u4f60\u7684\u4f3a\u670d\u5668"},"content":{"rendered":"<p>\u7576\u4f60\u628a\u7a0b\u5f0f\u78bc\u5f9e GitHub \u81ea\u52d5\u90e8\u7f72\u5230\u81ea\u5df1\u7684\u4f3a\u670d\u5668\u6642\uff0c\u53ef\u4ee5\u7bc0\u7701\u6642\u9593\u4e26\u907f\u514d\u51fa\u932f\u3002<a href=\"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/saas-deployment-region-selection-hong-kong-us-or-japan\/\" target=\"_blank\" rel=\"noopener\">\u90e8\u7f72\u81ea\u52d5\u5316<\/a>\u80fd\u5920\u5e36\u4f86\u66f4\u5feb\u7684\u56de\u994b\uff0c\u4e5f\u6709\u52a9\u65bc\u5718\u968a\u66f4\u9ad8\u6548\u5730\u5354\u4f5c\u3002\u85c9\u52a9 GitHub Actions\u3001Webhook \u548c\u90e8\u7f72\u8173\u672c\u7b49\u5de5\u5177\uff0c\u4f60\u53ef\u4ee5\u6e1b\u5c11\u4eba\u70ba\u5931\u8aa4\uff0c\u8b93\u6574\u500b\u6d41\u7a0b\u66f4\u52a0\u7a69\u5b9a\u53ef\u9760\u3002\u5373\u4f7f\u4f60\u53ea\u638c\u63e1\u4e86 GitHub \u548c<a href=\"https:\/\/www.simcentric.com\/tc\/products\/dedicated-server-hk\/\" target=\"_blank\" rel=\"noopener\">\u4f3a\u670d\u5668\u7ba1\u7406<\/a>\u7684\u57fa\u790e\u77e5\u8b58\uff0c\u4e5f\u80fd\u5efa\u7acb\u9019\u5957\u5de5\u4f5c\u6d41\u7a0b\uff0c\u4e26\u5f88\u5feb\u770b\u5230\u6539\u5584\u6548\u679c\u3002<\/p>\n<h2><strong>\u91cd\u9ede\u6574\u7406<\/strong><\/h2>\n<ul>\n<li>\u5c07\u7a0b\u5f0f\u78bc\u90e8\u7f72\u81ea\u52d5\u5316\u53ef\u4ee5\u7bc0\u7701\u6642\u9593\u4e26\u6e1b\u5c11\u932f\u8aa4\u3002\u4f7f\u7528 GitHub Actions \u548c Webhook \u7b49\u5de5\u5177\uff0c\u53ef\u4ee5\u8b93\u6d41\u7a0b\u66f4\u52a0\u9806\u66a2\u3002<\/li>\n<li>\u6e96\u5099\u597d\u5fc5\u8981\u7684\u5de5\u5177\u548c\u5e33\u6236\uff0c\u5305\u62ec GitHub \u5132\u5b58\u5eab\u3001\u96f2\u7aef\u4f3a\u670d\u5668\u4ee5\u53ca\u90e8\u7f72\u8173\u672c\u3002\u9019\u4e9b\u57fa\u790e\u8a2d\u5b9a\u662f\u6210\u529f\u5be6\u73fe\u81ea\u52d5\u5316\u7684\u95dc\u9375\u3002<\/li>\n<li>\u900f\u904e SSH \u91d1\u9470\u5be6\u73fe\u514d\u5bc6\u78bc\u5b58\u53d6\uff0c\u4fdd\u969c\u4f3a\u670d\u5668\u5b89\u5168\u3002\u9019\u80fd\u78ba\u4fdd\u53ea\u6709\u53d7\u4fe1\u4efb\u7684\u7cfb\u7d71\u53ef\u4ee5\u9023\u7dda\u5230\u4f60\u7684\u4f3a\u670d\u5668\u3002<\/li>\n<li>\u5728\u6b63\u5f0f\u4e0a\u7dda\u524d\uff0c\u5148\u5728\u9810\u5099\u4f3a\u670d\u5668\u4e0a\u6e2c\u8a66\u90e8\u7f72\u6d41\u7a0b\u3002\u9019\u6a23\u53ef\u4ee5\u53ca\u65e9\u767c\u73fe\u554f\u984c\uff0c\u4fdd\u8b77\u6b63\u5f0f\u74b0\u5883\u3002<\/li>\n<li>\u4f7f\u7528 GitHub Secrets \u5b89\u5168\u5132\u5b58\u654f\u611f\u8cc7\u8a0a\u3002\u9019\u53ef\u4ee5\u8b93\u5bc6\u78bc\u548c\u91d1\u9470\u4e0d\u6703\u66b4\u9732\u5728\u5de5\u4f5c\u6d41\u7a0b\u6a94\u6848\u4e2d\u3002<\/li>\n<\/ul>\n<h2><strong>\u81ea\u52d5\u90e8\u7f72\u7684\u524d\u7f6e\u689d\u4ef6<\/strong><\/h2>\n<h3>\u6240\u9700\u5de5\u5177\u8207\u5e33\u6236<\/h3>\n<p>\u5728\u958b\u59cb\u8a2d\u5b9a\u81ea\u52d5\u90e8\u7f72\u4e4b\u524d\uff0c\u4f60\u9700\u8981\u6e96\u5099\u4e00\u4e9b\u5fc5\u8981\u7684\u5de5\u5177\u548c\u5e33\u6236\u3002\u5b83\u5011\u5c07\u5e6b\u52a9\u4f60\u628a GitHub \u4e0a\u7684\u7a0b\u5f0f\u78bc\u9023\u63a5\u5230\u4f3a\u670d\u5668\uff0c\u4e26\u8b93\u6574\u500b\u6d41\u7a0b\u66f4\u52a0\u9806\u66a2\u3002<\/p>\n<ol>\n<li><strong>\u7dda\u4e0a\u9060\u7aef\u5132\u5b58\u5eab<\/strong>\uff1a\u4f60\u9700\u8981\u4e00\u500b GitHub \u5e33\u6236\uff0c\u4e26\u64c1\u6709\u4e00\u500b\u5b58\u653e\u5c08\u6848\u7a0b\u5f0f\u78bc\u7684\u5132\u5b58\u5eab\u3002<\/li>\n<li><strong>\u672c\u6a5f Git \u5132\u5b58\u5eab<\/strong>\uff1a\u5728\u4f60\u7684\u96fb\u8166\u4e0a\u8a2d\u5b9a\u4e00\u500b\u672c\u6a5f Git \u5132\u5b58\u5eab\uff0c\u7528\u65bc\u7ba1\u7406\u7a0b\u5f0f\u78bc\u8b8a\u66f4\u3002<\/li>\n<li><strong>\u96f2\u7aef\u4f3a\u670d\u5668<\/strong>\uff1a\u9078\u64c7\u4e00\u500b\u96f2\u7aef\u4f3a\u670d\u5668\u4f9b\u61c9\u5546\uff0c\u4f8b\u5982 Amazon EC2 \u6216 Rackspace\u3002\u4f60\u7684\u7db2\u7ad9\u6216\u61c9\u7528\u7a0b\u5f0f\u5c07\u57f7\u884c\u65bc\u6b64\u3002<\/li>\n<li><strong>\u90e8\u7f72\u8173\u672c<\/strong>\uff1a\u64b0\u5beb\u4e00\u500b\u90e8\u7f72\u8173\u672c\uff0c\u4f8b\u5982 <code>deploy.php<\/code>\uff0c\u7528\u4f86\u62c9\u53d6 GitHub \u4e0a\u7684\u6700\u65b0\u7a0b\u5f0f\u78bc\u3002<\/li>\n<li><strong>\u5728\u4f3a\u670d\u5668\u4e0a\u5b89\u88dd Git<\/strong>\uff1a\u8acb\u78ba\u8a8d\u4f60\u7684\u4f3a\u670d\u5668\u5df2\u5b89\u88dd Git\uff0c\u4e14\u7248\u672c\u70ba\u6700\u65b0\u3002<\/li>\n<li><strong>SSH \u91d1\u9470\u8a2d\u5b9a<\/strong>\uff1a\u5728\u4f3a\u670d\u5668\u4e0a\u7522\u751f SSH \u91d1\u9470\uff0c\u4ee5\u5be6\u73fe\u8207 GitHub \u7684\u5b89\u5168\u514d\u5bc6\u78bc\u901a\u8a0a\u3002<\/li>\n<li><strong>\u5c07 SSH \u516c\u9470\u52a0\u5165 GitHub<\/strong>\uff1a\u628a\u4f3a\u670d\u5668\u7684 SSH \u516c\u9470\u52a0\u5165\u4f60\u7684 GitHub \u5e33\u6236\u4e2d\uff0c\u4ee5\u4fbf\u4f3a\u670d\u5668\u80fd\u5920\u5b58\u53d6\u5132\u5b58\u5eab\u3002<\/li>\n<li><strong>\u8a2d\u5b9a Post-Receive Hook<\/strong>\uff1a\u5728 GitHub \u4e2d\u8a2d\u5b9a post-receive hook\uff0c\u7528\u4f86\u89f8\u767c\u4f60\u7684\u90e8\u7f72\u8173\u672c\u3002<\/li>\n<\/ol>\n<blockquote><p><strong>\u63d0\u793a\uff1a<\/strong>\u8acb\u59a5\u5584\u4fdd\u7ba1\u4f60\u7684 SSH \u91d1\u9470\u3002\u7d55\u4e0d\u8981\u5c07\u79c1\u9470\u5206\u4eab\u7d66\u4efb\u4f55\u4eba\u3002<\/p><\/blockquote>\n<h3>\u6e96\u5099\u4f60\u7684\u4f3a\u670d\u5668<\/h3>\n<p>\u4f60\u5fc5\u9808\u5148\u6e96\u5099\u597d\u4f3a\u670d\u5668\uff0c\u4ee5\u4fbf\u63a5\u6536\u4f86\u81ea GitHub \u7684\u7a0b\u5f0f\u78bc\u66f4\u65b0\u3002\u9019\u6a23\u7684\u8a2d\u5b9a\u53ef\u4ee5\u78ba\u4fdd\u6bcf\u6b21\u81ea\u52d5\u90e8\u7f72\u90fd\u80fd\u9806\u5229\u57f7\u884c\u3002<\/p>\n<ul>\n<li>\u5c07\u4f60\u7684 GitHub \u5132\u5b58\u5eab\u8907\u88fd\u5230\u4f3a\u670d\u5668\u4e0a\u7684\u67d0\u500b\u76ee\u9304\u3002\u4f60\u53ef\u4ee5\u70ba\u6b63\u5f0f\u74b0\u5883\u548c\u9810\u5099\u74b0\u5883\u5206\u5225\u5efa\u7acb\u4e0d\u540c\u7684\u76ee\u9304\u3002<\/li>\n<li>\u64b0\u5beb Bash \u90e8\u7f72\u8173\u672c\uff0c\u4e26\u8ce6\u4e88\u9019\u4e9b\u8173\u672c\u57f7\u884c\u6b0a\u9650\uff0c\u4ee5\u4fbf\u5b83\u5011\u80fd\u5920\u53d6\u5f97\u6700\u65b0\u7a0b\u5f0f\u78bc\u4e26\u57f7\u884c\u3002<\/li>\n<li>\u8a02\u95b1 GitHub \u7684 Webhook API\u3002\u9019\u6a23\u4f60\u7684\u4f3a\u670d\u5668\u5c31\u80fd\u76e3\u807d\u4e8b\u4ef6\uff0c\u4e26\u5728\u9700\u8981\u6642\u81ea\u52d5\u958b\u59cb\u90e8\u7f72\u6d41\u7a0b\u3002<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u662f\u4e00\u500b\u7c21\u55ae\u7684\u5132\u5b58\u5eab\u8907\u88fd\u547d\u4ee4\uff1a<\/p>\n<pre><code>git clone git@github.com:yourusername\/your-repo.git\r\n<\/code><\/pre>\n<p>\u5b8c\u6210\u9019\u4e9b\u6b65\u9a5f\u5f8c\uff0c\u4f60\u7684\u4f3a\u670d\u5668\u5c31\u53ef\u4ee5\u9032\u884c\u81ea\u52d5\u90e8\u7f72\u4e86\u3002\u6bcf\u6b21\u90e8\u7f72\u65b0\u7a0b\u5f0f\u78bc\u6642\uff0c\u4f60\u90fd\u80fd\u7bc0\u7701\u6642\u9593\u4e26\u6e1b\u5c11\u932f\u8aa4\u3002<\/p>\n<h2><strong>\u4f7f\u7528 GitHub Actions \u81ea\u52d5\u90e8\u7f72\u7a0b\u5f0f\u78bc<\/strong><\/h2>\n<p>\u4f60\u53ef\u4ee5\u85c9\u52a9 GitHub Actions \u5c07\u7a0b\u5f0f\u78bc\u81ea\u52d5\u90e8\u7f72\u5230\u4f3a\u670d\u5668\u3002\u9019\u500b\u5de5\u5177\u53ef\u4ee5\u5e6b\u52a9\u4f60\u5728\u6bcf\u6b21\u63a8\u9001\u8b8a\u66f4\u6642\u81ea\u52d5\u57f7\u884c\u8173\u672c\u4e26\u767c\u4f48\u7a0b\u5f0f\u78bc\u3002\u4f60\u4e0d\u518d\u9700\u8981\u624b\u52d5\u767b\u5165\u4f3a\u670d\u5668\u6216\u624b\u52d5\u57f7\u884c\u547d\u4ee4\uff0c\u6574\u500b\u904e\u7a0b\u6703\u66f4\u52a0\u6d41\u66a2\u4e14\u53ef\u91cd\u8907\u3002<\/p>\n<h3>\u5efa\u7acb\u5de5\u4f5c\u6d41\u7a0b\u6a94\u6848<\/h3>\n<p>\u8981\u5be6\u73fe\u7a0b\u5f0f\u78bc\u81ea\u52d5\u90e8\u7f72\uff0c\u4f60\u9700\u8981\u5728\u5132\u5b58\u5eab\u4e2d\u5efa\u7acb\u4e00\u500b\u5de5\u4f5c\u6d41\u7a0b\u6a94\u6848\u3002\u9019\u500b\u6a94\u6848\u6703\u544a\u8a34 GitHub Actions\uff1a\u7576\u4f60\u63a8\u9001\u65b0\u7a0b\u5f0f\u78bc\u6642\uff0c\u9700\u8981\u57f7\u884c\u54ea\u4e9b\u64cd\u4f5c\u3002\u8acb\u5c07\u8a72\u6a94\u6848\u653e\u5728 <code>.github\/workflows\/<\/code> \u76ee\u9304\u4e2d\uff0c\u4e26\u547d\u540d\u70ba\u985e\u4f3c <code>main.yml<\/code> \u7684\u540d\u7a31\u3002<\/p>\n<blockquote><p>\u4e0b\u9762\u662f\u4e00\u500b\u5de5\u4f5c\u6d41\u7a0b\u6a94\u6848\u7bc4\u4f8b\uff1a\u5b83\u6703\u5728\u6bcf\u6b21\u63a8\u9001\u6a19\u7c64\u6642\u89f8\u767c\uff0c\u4e26\u57f7\u884c\u90e8\u7f72\u5de5\u4f5c\uff1a<\/p>\n<pre><code>name: Deploy on Tag\r\n\r\non:\r\n  push:\r\n    tags:\r\n      - '*'\r\n\r\njobs:\r\n  deploy:\r\n    runs-on: ubuntu-latest\r\n\r\n    steps:\r\n    - name: Checkout Repository\r\n      uses: actions\/checkout@v3\r\n\r\n    - name: Deploy to Test Server\r\n      env:\r\n        REMOTE_PATH: [your remote path location]\r\n      if: startsWith(github.ref, 'refs\/tags\/') &amp;&amp; contains(github.ref, 'rc')\r\n      run: |\r\n        mkdir -p ~\/.ssh\r\n        echo \"${{ secrets.TEST_SSH_PRIVATE_KEY }}\" &gt; ~\/.ssh\/id_rsa\r\n        cd ~\/.ssh\r\n        chmod 600 id_rsa\r\n        ssh -o StrictHostKeyChecking=no -i ~\/.ssh\/id_rsa ${{ secrets.TEST_SSH_USERNAME }}@${{ secrets.TEST_SERVER }} 'echo \"${{secrets.REPO_DEPLOY_KEY}}\" &gt; ~\/.ssh\/gh_key &amp;&amp; chmod 600 ~\/.ssh\/gh_key &amp;&amp; eval `ssh-agent -s` &amp;&amp; ssh-add ~\/.ssh\/gh_key &amp;&amp; cd ${{ env.REMOTE_PATH }} &amp;&amp; git fetch --tags &amp;&amp; git checkout ${{ github.ref }} &amp;&amp; \/usr\/bin\/docker compose run --rm backend php yii migrate --interactive=0 &amp;&amp; \/usr\/bin\/docker compose run --rm backend php yii cache\/flush-all &amp;&amp; rm -f ~\/.ssh\/gh_key'\r\n<\/code><\/pre>\n<\/blockquote>\n<p>\u9019\u500b\u5de5\u4f5c\u6d41\u7a0b\u6703\u5148\u7c3d\u51fa\u4f60\u7684\u7a0b\u5f0f\u78bc\uff0c\u7136\u5f8c\u9023\u7dda\u5230\u4f3a\u670d\u5668\uff0c\u4e26\u57f7\u884c\u547d\u4ee4\u4f86\u66f4\u65b0\u5c08\u6848\u3002\u4f60\u53ef\u4ee5\u6839\u64da\u81ea\u5df1\u7684\u9700\u6c42\u8abf\u6574\u9019\u4e9b\u6b65\u9a5f\u3002<\/p>\n<p>\u5728\u5efa\u7acb\u5de5\u4f5c\u6d41\u7a0b\u6a94\u6848\u6642\uff0c\u4f60\u53ef\u80fd\u6703\u9047\u5230\u4e00\u4e9b\u5e38\u898b\u554f\u984c\uff1a<\/p>\n<ul>\n<li>\u5de5\u4f5c\u6d41\u7a0b\u6c92\u6709\u89f8\u767c\u3002\u8acb\u78ba\u8a8d\u6a94\u6848\u4f4d\u65bc <code>.github\/workflows\/main.yml<\/code>\u3002<\/li>\n<li>YAML \u8a9e\u6cd5\u932f\u8aa4\u3002\u8acb\u78ba\u4fdd\u6bcf\u4e00\u7d1a\u7e2e\u6392\u4f7f\u7528\u5169\u500b\u7a7a\u683c\u3002<\/li>\n<li>\u627e\u4e0d\u5230\u547d\u4ee4\u3002\u8acb\u6aa2\u67e5 GitHub runner \u4e0a\u662f\u5426\u5b89\u88dd\u4e86\u6240\u6709\u6240\u9700\u5de5\u5177\u3002<\/li>\n<\/ul>\n<p>\u4f60\u53ef\u4ee5\u900f\u904e\u53cd\u8986\u6aa2\u67e5\u6a94\u6848\u4f4d\u7f6e\u548c\u8a9e\u6cd5\u4f86\u907f\u514d\u9019\u4e9b\u554f\u984c\u3002<\/p>\n<h3>\u8a2d\u5b9a\u74b0\u5883\u8207 Secrets<\/h3>\n<p>\u5728\u81ea\u52d5\u90e8\u7f72\u7a0b\u5f0f\u78bc\u6642\uff0c\u4f60\u5fc5\u9808\u78ba\u4fdd\u4f3a\u670d\u5668\u5b89\u5168\u3002\u7d55\u4e0d\u8981\u628a\u5bc6\u78bc\u6216\u79c1\u9470\u76f4\u63a5\u5beb\u9032\u5de5\u4f5c\u6d41\u7a0b\u6a94\u6848\u3002\u76f8\u53cd\u5730\uff0c\u4f60\u61c9\u8a72\u4f7f\u7528 GitHub Secrets \u4f86\u5132\u5b58\u654f\u611f\u8cc7\u8a0a\u3002<\/p>\n<p>\u9032\u5165\u4f60\u7684\u5132\u5b58\u5eab\u8a2d\u5b9a\u9801\u9762\uff0c\u627e\u5230\u300cSecrets\u300d\u90e8\u5206\u3002\u65b0\u589e SSH \u79c1\u9470\u3001\u4f3a\u670d\u5668\u4f7f\u7528\u8005\u540d\u7a31\u4ee5\u53ca\u5176\u4ed6\u654f\u611f\u8cc7\u8a0a\u3002\u5728\u5de5\u4f5c\u6d41\u7a0b\u6a94\u6848\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 <code>${{ secrets.YOUR_SECRET_NAME }}<\/code> \u7684\u5f62\u5f0f\u4f86\u5f15\u7528\u9019\u4e9b Secrets\u3002\u9019\u6a23\u53ef\u4ee5\u78ba\u4fdd\u4f60\u7684\u8cc7\u6599\u5b89\u5168\u4e14\u4e0d\u6703\u5916\u6d29\u3002<\/p>\n<p>\u4f60\u4e5f\u53ef\u4ee5\u70ba\u6e2c\u8a66\u74b0\u5883\u548c\u6b63\u5f0f\u74b0\u5883\u5206\u5225\u8a2d\u5b9a\u4e0d\u540c\u7684 Environment\u3002\u9019\u6a23\u4e00\u4f86\uff0c\u4f60\u53ef\u4ee5\u5148\u628a\u7a0b\u5f0f\u78bc\u81ea\u52d5\u90e8\u7f72\u5230\u6e2c\u8a66\u4f3a\u670d\u5668\uff1b\u5982\u679c\u4e00\u5207\u6b63\u5e38\uff0c\u518d\u90e8\u7f72\u5230\u6b63\u5f0f\u4f3a\u670d\u5668\u3002\u85c9\u52a9 GitHub Actions\uff0c\u4f60\u53ef\u4ee5\u7cbe\u78ba\u63a7\u5236\u7a0b\u5f0f\u78bc\u5728\u4f55\u6642\u3001\u90e8\u7f72\u5230\u54ea\u88e1\u3002<\/p>\n<p>\u6309\u7167\u9019\u4e9b\u6b65\u9a5f\u64cd\u4f5c\u5f8c\uff0c\u6bcf\u6b21\u4f60\u63a8\u9001\u8b8a\u66f4\u6642\uff0c\u7a0b\u5f0f\u78bc\u90fd\u6703\u81ea\u52d5\u90e8\u7f72\u3002\u4f60\u5c07\u7bc0\u7701\u6642\u9593\u3001\u6e1b\u5c11\u932f\u8aa4\uff0c\u4e26\u8b93\u6574\u500b\u90e8\u7f72\u6d41\u7a0b\u66f4\u52a0\u7a69\u56fa\u3001\u5b89\u5168\u3002<\/p>\n<h2><strong>\u4f7f\u7528 Webhook \u5be6\u73fe\u81ea\u52d5\u90e8\u7f72<\/strong><\/h2>\n<p>Webhook \u662f\u5be6\u73fe\u90e8\u7f72\u81ea\u52d5\u5316\u7684\u4e00\u7a2e\u975e\u5e38\u6709\u529b\u7684\u65b9\u5f0f\u3002\u8a2d\u5b9a\u5b8c\u6210\u5f8c\uff0c\u4f60\u7684\u4f3a\u670d\u5668\u53ef\u4ee5\u76e3\u807d\u4f86\u81ea GitHub \u7684\u4e8b\u4ef6\uff0c\u4e26\u5728\u6536\u5230\u901a\u77e5\u5f8c\u81ea\u52d5\u66f4\u65b0\u7a0b\u5f0f\u78bc\u3002\u5982\u679c\u4f60\u5e0c\u671b\u5728\u81ea\u5df1\u7684\u4f3a\u670d\u5668\u4e0a\u638c\u63a7\u6574\u500b\u90e8\u7f72\u6d41\u7a0b\uff0c\u9019\u7a2e\u65b9\u6cd5\u6703\u975e\u5e38\u9069\u5408\u3002<\/p>\n<h3>\u64b0\u5beb Webhook \u76e3\u807d\u8173\u672c<\/h3>\n<p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u4e00\u500b\u7528\u65bc\u76e3\u807d Webhook \u8acb\u6c42\u7684\u8173\u672c\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528 PHP\u3001Node.js\uff0c\u6216\u5176\u4ed6\u80fd\u5920\u8655\u7406 HTTP POST \u8acb\u6c42\u7684\u8a9e\u8a00\u3002\u9019\u500b\u8173\u672c\u6703\u5728\u4f60\u5411\u5132\u5b58\u5eab\u63a8\u9001\u8b8a\u66f4\u6642\u63a5\u6536\u4f86\u81ea GitHub \u7684\u901a\u77e5\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u4e00\u5957\u5178\u578b\u7684 Webhook \u76e3\u807d\u5668\u8a2d\u5b9a\u6d41\u7a0b\uff1a<\/p>\n<ol>\n<li>\u5c07\u4f60\u7684 Git \u5132\u5b58\u5eab\u5206\u5225\u8907\u88fd\u5230\u6b63\u5f0f\u74b0\u5883\u548c\u9810\u5099\u74b0\u5883\u5c0d\u61c9\u7684\u76ee\u9304\u4e2d\u3002<\/li>\n<li>\u70ba\u6bcf\u500b\u74b0\u5883\u5efa\u7acb Bash \u8173\u672c\uff0c\u4e26\u8ce6\u4e88\u9019\u4e9b\u8173\u672c\u57f7\u884c\u6b0a\u9650\uff0c\u4ee5\u4fbf\u81ea\u52d5\u57f7\u884c\u3002<\/li>\n<li>\u64b0\u5beb\u8655\u7406 Webhook \u4e8b\u4ef6\u7684\u7a0b\u5f0f\u78bc\u3002\u8a31\u591a\u958b\u767c\u8005\u6703\u5728 Node.js \u4e2d\u4f7f\u7528 <code>github-webhook-handler<\/code> \u5957\u4ef6\uff0c\u4f46\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528 PHP \u6216 Python\u3002<\/li>\n<li>\u5728 GitHub \u5132\u5b58\u5eab\u8a2d\u5b9a\u4e2d\u914d\u7f6e Webhook URL\u3002\u9078\u64c7\u7528\u4f86\u89f8\u767c Webhook \u7684\u4e8b\u4ef6\uff0c\u4f8b\u5982 push \u6216 pull request\u3002<\/li>\n<li>\u6e2c\u8a66\u4e26\u9a57\u8b49\u4f60\u7684\u8a2d\u5b9a\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528 PM2 \u9019\u985e\u884c\u7a0b\u7ba1\u7406\u5de5\u5177\u4f86\u76e3\u63a7\u8173\u672c\uff0c\u4e26\u900f\u904e\u65e5\u8a8c\u6392\u67e5\u932f\u8aa4\u3002<\/li>\n<\/ol>\n<p>\u4e0b\u9762\u662f\u4e00\u500b\u7c21\u55ae\u7684 PHP Webhook \u76e3\u807d\u8173\u672c\u7bc4\u4f8b\uff1a<\/p>\n<pre><code>&lt;?php\r\n$secret = 'your_webhook_secret';\r\n$payload = file_get_contents('php:\/\/input');\r\n$signature = 'sha1=' . hash_hmac('sha1', $payload, $secret);\r\n\r\nif (hash_equals($signature, $_SERVER['HTTP_X_HUB_SIGNATURE'])) {\r\n    \/\/ Run your deployment script\r\n    shell_exec('\/path\/to\/deploy.sh');\r\n    http_response_code(200);\r\n    echo \"Deployment triggered.\";\r\n} else {\r\n    http_response_code(403);\r\n    echo \"Invalid signature.\";\r\n}\r\n?&gt;\r\n<\/code><\/pre>\n<blockquote><p><strong>\u63d0\u793a\uff1a<\/strong>\u4e00\u5b9a\u8981\u4f7f\u7528 GitHub \u63d0\u4f9b\u7684\u7bc4\u4f8b payload \u6e2c\u8a66\u4f60\u7684 Webhook \u76e3\u807d\u5668\u3002\u9019\u6a23\u53ef\u4ee5\u5e6b\u52a9\u4f60\u5728\u5f71\u97ff\u7dda\u4e0a\u7db2\u7ad9\u4e4b\u524d\u767c\u73fe\u932f\u8aa4\u3002<\/p><\/blockquote>\n<h3>\u8a2d\u5b9a GitHub Webhook<\/h3>\n<p>\u5efa\u7acb\u597d\u76e3\u807d\u8173\u672c\u4e4b\u5f8c\uff0c\u4f60\u9084\u9700\u8981\u5728 GitHub \u5132\u5b58\u5eab\u4e2d\u8a2d\u5b9a Webhook\u3002\u9019\u4e00\u6b65\u6703\u628a\u4f60\u7684\u5132\u5b58\u5eab\u548c\u4f3a\u670d\u5668\u9023\u63a5\u8d77\u4f86\uff0c\u4e26\u544a\u8a34 GitHub \u61c9\u8a72\u628a\u901a\u77e5\u9001\u5230\u54ea\u88e1\u3002<\/p>\n<p>\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u8a2d\u5b9a\u4f60\u7684 Webhook\uff1a<\/p>\n<ol>\n<li>\u64b0\u5beb\u8655\u7406 Webhook \u4e8b\u4ef6\u7684\u7a0b\u5f0f\u78bc\uff0c\u4e26\u78ba\u4fdd\u4f60\u7684\u4f3a\u670d\u5668\u64c1\u6709\u4e00\u500b GitHub \u53ef\u4ee5\u5b58\u53d6\u7684\u516c\u958b URL\u3002<\/li>\n<li>\u5982\u679c\u4f60\u60f3\u7c21\u5316\u4e8b\u4ef6\u8655\u7406\u6d41\u7a0b\uff0c\u53ef\u4ee5\u4f7f\u7528\u50cf <code>github-webhook-handler<\/code> \u9019\u6a23\u7684\u5957\u4ef6\u3002<\/li>\n<li>\u57f7\u884c\u4f60\u7684\u670d\u52d9\u7a0b\u5f0f\uff0c\u8b93\u5b83\u958b\u59cb\u76e3\u807d\u50b3\u5165\u7684 Webhook \u8acb\u6c42\u3002<\/li>\n<li>\u9032\u5165 GitHub \u5132\u5b58\u5eab\u8a2d\u5b9a\u9801\u9762\uff0c\u65b0\u589e\u4e00\u500b Webhook\uff0c\u4e26\u586b\u5beb\u76e3\u807d\u8173\u672c\u7684 URL\u3002<\/li>\n<li>\u9078\u64c7\u61c9\u8a72\u89f8\u767c Webhook \u7684\u4e8b\u4ef6\uff0c\u4f8b\u5982 push \u4e8b\u4ef6\u6216 pull request\u3002<\/li>\n<\/ol>\n<p>\u5728\u4f7f\u7528 Webhook \u6642\uff0c\u5b89\u5168\u6027\u975e\u5e38\u91cd\u8981\u3002\u4f60\u9700\u8981\u78ba\u4fdd\u53ea\u6709 GitHub \u624d\u80fd\u89f8\u767c\u4f3a\u670d\u5668\u4e0a\u7684\u90e8\u7f72\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u95dc\u9375\u7684\u5b89\u5168\u6ce8\u610f\u4e8b\u9805\uff1a<\/p>\n<div class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 50px;\">\n<colgroup>\n<col style=\"min-width: 25px;\" \/>\n<col style=\"min-width: 25px;\" \/> <\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\u5b89\u5168\u6ce8\u610f\u4e8b\u9805<\/th>\n<th colspan=\"1\" rowspan=\"1\">\u8aaa\u660e<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\u4f7f\u7528\u5bc6\u9470\u9032\u884c\u9a57\u8b49<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u70ba\u4f60\u7684 Webhook \u65b0\u589e\u4e00\u500b\u5bc6\u9470\uff0c\u4ee5\u5e6b\u52a9\u78ba\u8a8d\u8acb\u6c42\u78ba\u5be6\u4f86\u81ea GitHub\u3002<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">Webhook URL \u7684\u53ef\u5b58\u53d6\u6027<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u8acb\u59a5\u5584\u4fdd\u8b77\u4f60\u7684 Webhook URL\uff0c\u4e0d\u8981\u96a8\u610f\u516c\u958b\uff0c\u4ee5\u9632\u6b62\u672a\u7d93\u6388\u6b0a\u7684\u5b58\u53d6\u3002<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\u4f7f\u7528 HTTPS<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u8a2d\u5b9a HTTPS\uff0c\u4ee5\u52a0\u5bc6 GitHub \u8207\u4f3a\u670d\u5668\u4e4b\u9593\u7684\u901a\u8a0a\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<blockquote><p><strong>\u6ce8\u610f\uff1a<\/strong>\u5982\u679c\u4f60\u4f7f\u7528\u4e86\u5bc6\u9470\uff0c\u8acb\u540c\u6b65\u66f4\u65b0\u76e3\u807d\u8173\u672c\uff0c\u4ee5\u9a57\u8b49\u50b3\u5165\u8acb\u6c42\u7684\u7c3d\u7ae0\u3002\u9019\u6703\u589e\u52a0\u4e00\u5c64\u984d\u5916\u7684\u5b89\u5168\u4fdd\u8b77\u3002<\/p><\/blockquote>\n<p>\u5b8c\u6210\u9019\u4e9b\u6b65\u9a5f\u5f8c\uff0c\u6bcf\u6b21\u4f60\u5411\u5132\u5b58\u5eab\u63a8\u9001\u7a0b\u5f0f\u78bc\uff0c\u4f3a\u670d\u5668\u90fd\u6703\u81ea\u52d5\u90e8\u7f72\u6700\u65b0\u7248\u672c\u3002\u9019\u6a23\u7684\u8a2d\u5b9a\u53ef\u4ee5\u7bc0\u7701\u6642\u9593\uff0c\u4e26\u6e1b\u5c11\u624b\u52d5\u64cd\u4f5c\u5e36\u4f86\u7684\u98a8\u96aa\u3002<\/p>\n<h2><strong>\u5b89\u5168\u7684\u4f3a\u670d\u5668\u5b58\u53d6\u8207 SSH \u91d1\u9470<\/strong><\/h2>\n<p>\u8a2d\u5b9a\u5b89\u5168\u5b58\u53d6\u6a5f\u5236\uff0c\u662f\u4efb\u4f55\u81ea\u52d5\u5316\u90e8\u7f72\u6d41\u7a0b\u4e2d\u90fd\u975e\u5e38\u95dc\u9375\u7684\u4e00\u90e8\u5206\u3002\u4f60\u9700\u8981\u78ba\u4fdd\u53ea\u6709\u53d7\u4fe1\u4efb\u7684\u4f7f\u7528\u8005\u548c\u7cfb\u7d71\u80fd\u5920\u9023\u7dda\u5230\u4f3a\u670d\u5668\u3002\u4f7f\u7528 SSH \u91d1\u9470\u53ef\u4ee5\u5e6b\u52a9\u4f60\u5be6\u73fe\u5b89\u5168\u3001\u514d\u5bc6\u78bc\u7684\u9023\u7dda\u3002<\/p>\n<h3>\u7522\u751f SSH \u91d1\u9470<\/h3>\n<p>\u4f60\u53ef\u4ee5\u900f\u904e\u7522\u751f SSH \u91d1\u9470\uff0c\u8b93\u90e8\u7f72\u6d41\u7a0b\u5b89\u5168\u5730\u9023\u7dda\u5230\u4f3a\u670d\u5668\u3002\u8acb\u4f9d\u7167\u4ee5\u4e0b\u6b65\u9a5f\u70ba\u90e8\u7f72\u4f7f\u7528\u8005\u8a2d\u5b9a SSH \u91d1\u9470\uff1a<\/p>\n<ol>\n<li>\u5728\u672c\u6a5f\u4e0a\u7522\u751f\u4e00\u5c0d\u65b0\u7684 SSH \u91d1\u9470\uff1a\n<pre><code>ssh-keygen -t ed25519 -f ~\/.ssh\/blog_deployer<\/code><\/pre>\n<\/li>\n<li>\u5728\u4f3a\u670d\u5668\u4e0a\u5efa\u7acb\u4e00\u500b\u5c08\u9580\u7528\u65bc\u90e8\u7f72\u7684\u4f7f\u7528\u8005\uff1a\n<pre><code>useradd blog-deployer<\/code><\/pre>\n<\/li>\n<li>\u9396\u5b9a\u8a72\u4f7f\u7528\u8005\u7684\u5bc6\u78bc\uff0c\u9632\u6b62\u5176\u900f\u904e\u5bc6\u78bc\u767b\u5165\uff1a\n<pre><code>passwd -l blog-deployer<\/code><\/pre>\n<\/li>\n<li>\u70ba\u65b0\u4f7f\u7528\u8005\u5efa\u7acb\u4e00\u500b <code>.ssh<\/code> \u76ee\u9304\uff1a\n<pre><code>mkdir -p \/home\/blog-deployer\/.ssh<\/code><\/pre>\n<\/li>\n<li>\u5c07\u516c\u9470\u52a0\u5165 <code>authorized_keys<\/code> \u6a94\u6848\u4e2d\uff1a\n<pre><code>nano \/home\/blog-deployer\/.ssh\/authorized_keys<\/code><\/pre>\n<\/li>\n<li>\u8b8a\u66f4\u4e3b\u76ee\u9304\u7684\u64c1\u6709\u6b0a\uff1a\n<pre><code>chown -R blog-deployer:blog-deployer \/home\/blog-deployer<\/code><\/pre>\n<\/li>\n<\/ol>\n<p>\u9019\u6a23\u8a2d\u5b9a\u4e4b\u5f8c\uff0c\u5c31\u53ea\u6709\u4f60\u7684\u90e8\u7f72\u7cfb\u7d71\u624d\u80fd\u9023\u7dda\u5230\u4f3a\u670d\u5668\u4e26\u5c07\u5c08\u6848\u90e8\u7f72\u5230\u4f3a\u670d\u5668\u4e0a\u3002<\/p>\n<h3>\u8a2d\u5b9a\u6b0a\u9650<\/h3>\n<p>\u4f60\u5fc5\u9808\u8a2d\u5b9a\u6b63\u78ba\u7684\u6b0a\u9650\uff0c\u624d\u80fd\u78ba\u4fdd\u90e8\u7f72\u904e\u7a0b\u7684\u5b89\u5168\u3002\u5982\u679c\u6b0a\u9650\u8a2d\u5b9a\u4e0d\u7576\uff0c\u653b\u64ca\u8005\u53ef\u80fd\u6703\u53d6\u5f97\u5b58\u53d6\u6b0a\u9650\uff0c\u751a\u81f3\u7aca\u53d6\u8cc7\u6599\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u6700\u4f73\u5be6\u52d9\uff1a<\/p>\n<ul>\n<li>\u9650\u5236\u90e8\u7f72\u4f7f\u7528\u8005\u7684 SSH \u767b\u5165\u80fd\u529b\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a\n<pre><code>restrict,pty,no-agent-forwarding,no-port-forwarding,no-X11-forwarding,command=\"\/usr\/local\/bin\/rrsync -wo \/var\/www\/blog\"\r\n<\/code><\/pre>\n<\/li>\n<li>\u9650\u5236\u90e8\u7f72\u4f7f\u7528\u8005\u53ef\u57f7\u884c\u7684\u64cd\u4f5c\uff0c\u53ea\u5141\u8a31\u57f7\u884c\u90e8\u7f72\u6240\u9700\u7684\u6700\u5c0f\u6b0a\u9650\u64cd\u4f5c\u3002<\/li>\n<li>\u5c07 Secrets \u548c\u91d1\u9470\u4fdd\u5b58\u5728\u5b89\u5168\u7684\u4fdd\u7ba1\u5eab\u4e2d\uff0c\u4e26\u78ba\u4fdd\u5176\u5728\u975c\u614b\u5132\u5b58\u548c\u50b3\u8f38\u904e\u7a0b\u4e2d\u90fd\u7d93\u904e\u52a0\u5bc6\u3002<\/li>\n<li>\u5b9a\u671f\u7a3d\u6838\u4e26\u76e3\u63a7\u4f3a\u670d\u5668\u5b58\u53d6\u60c5\u6cc1\u3002<\/li>\n<li>\u5b9a\u671f\u8f2a\u66ff SSH \u91d1\u9470\u548c\u5404\u985e\u654f\u611f\u6191\u8b49\u3002<\/li>\n<\/ul>\n<blockquote><p><strong>\u63d0\u793a\uff1a<\/strong>\u52d9\u5fc5\u6aa2\u67e5 SSH \u91d1\u9470\u548c\u90e8\u7f72\u8173\u672c\u7684\u6b0a\u9650\u8a2d\u5b9a\u3002\u6b0a\u9650\u8a2d\u5b9a\u932f\u8aa4\u53ef\u80fd\u6703\u5c0e\u81f4\u672a\u7d93\u6388\u6b0a\u7684\u5b58\u53d6\u3001\u8cc7\u6599\u5916\u6d29\u6216\u906d\u53d7\u653b\u64ca\u3002<\/p><\/blockquote>\n<p>\u9075\u5faa\u9019\u4e9b\u6b65\u9a5f\u5f8c\uff0c\u4f60\u5c31\u80fd\u66f4\u597d\u5730\u4fdd\u8b77\u90e8\u7f72\u6d41\u7a0b\uff0c\u4e26\u78ba\u4fdd\u4f3a\u670d\u5668\u5b89\u5168\u3002<\/p>\n<h2><strong>\u6e2c\u8a66\u4e26\u90e8\u7f72\u4f60\u7684\u7db2\u7ad9<\/strong><\/h2>\n<h3>\u57f7\u884c\u4e00\u6b21\u6e2c\u8a66\u90e8\u7f72<\/h3>\n<p>\u5728\u5c07\u7db2\u7ad9\u90e8\u7f72\u5230\u6b63\u5f0f\u74b0\u5883\u4e4b\u524d\uff0c\u4f60\u61c9\u7576\u59cb\u7d42\u5148\u9032\u884c\u6e2c\u8a66\u3002\u6e2c\u8a66\u90e8\u7f72\u53ef\u4ee5\u5e6b\u52a9\u4f60\u53ca\u65e9\u767c\u73fe\u554f\u984c\uff0c\u4e26\u78ba\u4fdd\u6574\u500b\u6d41\u7a0b\u7b26\u5408\u9810\u671f\u3002\u8acb\u4f9d\u7167\u4ee5\u4e0b\u6b65\u9a5f\uff0c\u5f9e GitHub \u5411\u4f60\u7684\u79c1\u6709\u4f3a\u670d\u5668\u57f7\u884c\u4e00\u6b21\u6e2c\u8a66\u90e8\u7f72\uff1a<\/p>\n<ol>\n<li>\u6e96\u5099\u4f60\u7684\u4f3a\u670d\u5668\u3002\u4f7f\u7528\u4e00\u500b\u4e7e\u6de8\u7684 Linux \u7cfb\u7d71\uff0c\u4f8b\u5982 Ubuntu 22.04 \u6216\u66f4\u65b0\u7248\u672c\u3002\u78ba\u4fdd\u4f3a\u670d\u5668\u81f3\u5c11\u5177\u5099 4GB \u8a18\u61b6\u9ad4\u548c 2 \u500b CPU \u6838\u5fc3\uff0c\u4e26\u78ba\u8a8d\u5b83\u53ef\u4ee5\u9023\u4e0a\u7db2\u969b\u7db2\u8def\u3002<\/li>\n<li>\u5f9e GitHub \u8907\u88fd\u4f60\u7684\u90e8\u7f72\u5132\u5b58\u5eab\u3002\u4f7f\u7528\u6b63\u78ba\u7684 SSH \u91d1\u9470\u6216 HTTPS \u65b9\u5f0f\u4f86\u78ba\u4fdd\u5b58\u53d6\u5b89\u5168\u3002<\/li>\n<li>\u9078\u64c7\u4f60\u7684\u5b89\u88dd\u65b9\u5f0f\u3002\u5982\u679c\u4f60\u60f3\u5feb\u901f\u5b89\u88dd\uff0c\u53ef\u57f7\u884c\uff1a\n<pre><code>.\/scripts\/install-fast.sh<\/code><\/pre>\n<p>\u5982\u679c\u4f60\u9700\u8981\u81ea\u8a02\u5b89\u88dd\uff0c\u8acb\u5148\u6e96\u5099\u597d\u8a2d\u5b9a\u6a94\uff0c\u7136\u5f8c\u4f7f\u7528 Helm \u5b89\u88dd\u547d\u4ee4\u3002<\/li>\n<li>\u89f8\u767c\u90e8\u7f72\u3002\u5411\u5132\u5b58\u5eab\u63a8\u9001\u4e00\u6b21\u8b8a\u66f4\uff0c\u6216\u624b\u52d5\u89f8\u767c\u5de5\u4f5c\u6d41\u7a0b\u6216 Webhook\u3002<\/li>\n<li>\u67e5\u770b\u4f3a\u670d\u5668\u65e5\u8a8c\uff0c\u78ba\u8a8d\u90e8\u7f72\u8173\u672c\u5df2\u7d93\u57f7\u884c\u4e26\u6210\u529f\u66f4\u65b0\u6a94\u6848\u3002<\/li>\n<\/ol>\n<blockquote><p>\u63d0\u793a\uff1a\u5728\u5c07\u7db2\u7ad9\u90e8\u7f72\u5230\u6b63\u5f0f\u74b0\u5883\u4e4b\u524d\uff0c\u8acb\u52d9\u5fc5\u5148\u5728\u9810\u5099\u4f3a\u670d\u5668\u4e0a\u6e2c\u8a66\u3002\u9019\u80fd\u5920\u4fdd\u8b77\u4f60\u7684\u7dda\u4e0a\u7db2\u7ad9\u5b89\u5168\u3002<\/p><\/blockquote>\n<h3>\u6392\u89e3\u5e38\u898b\u554f\u984c<\/h3>\n<p>\u5728\u90e8\u7f72\u904e\u7a0b\u4e2d\uff0c\u4f60\u53ef\u80fd\u6703\u9047\u5230\u4e00\u4e9b\u5e38\u898b\u554f\u984c\u3002\u4e0b\u8868\u5217\u51fa\u4e86\u5e38\u898b\u932f\u8aa4\u3001\u6210\u56e0\u4ee5\u53ca\u9810\u9632\u63aa\u65bd\uff1a<\/p>\n<div class=\"qc-default-table-wrapper \">\n<table style=\"min-width: 100px;\">\n<colgroup>\n<col style=\"min-width: 25px;\" \/>\n<col style=\"min-width: 25px;\" \/>\n<col style=\"min-width: 25px;\" \/>\n<col style=\"min-width: 25px;\" \/> <\/colgroup>\n<tbody>\n<tr>\n<th colspan=\"1\" rowspan=\"1\">\u554f\u984c<\/th>\n<th colspan=\"1\" rowspan=\"1\">\u932f\u8aa4\u8a0a\u606f<\/th>\n<th colspan=\"1\" rowspan=\"1\">\u539f\u56e0<\/th>\n<th colspan=\"1\" rowspan=\"1\">\u9810\u9632\u63aa\u65bd<\/th>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\u6620\u5c04\u4e2d\u767c\u73fe\u91cd\u8907\u9375<\/td>\n<td colspan=\"1\" rowspan=\"1\">duplicate key found in mapping<\/td>\n<td colspan=\"1\" rowspan=\"1\">YAML \u89e3\u6790\u5668\u66f4\u65b0<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u5728\u7bc4\u672c\u4e2d\u4f7f\u7528\u552f\u4e00\u4e14\u63cf\u8ff0\u6e05\u695a\u7684\u547d\u540d<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\u627e\u4e0d\u5230 Secret<\/td>\n<td colspan=\"1\" rowspan=\"1\">Secret not found or variable is empty<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u8a9e\u6cd5\u932f\u8aa4<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u5728\u7bc4\u672c\u4e2d\u5c55\u793a\u6b63\u78ba\u7684\u4e0a\u4e0b\u6587\u8a9e\u6cd5<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\u77e9\u9663\u7b56\u7565\u932f\u8aa4<\/td>\n<td colspan=\"1\" rowspan=\"1\">Matrix not expanded, tests skipped<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u7121\u6548\u7684\u77e9\u9663\u8a2d\u5b9a<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u5728\u7bc4\u672c\u4e2d\u63d0\u4f9b\u4e00\u500b\u53ef\u6b63\u5e38\u904b\u4f5c\u7684\u77e9\u9663\u7bc4\u4f8b<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\u4e0a\u4e0b\u6587\u8a9e\u6cd5\u932f\u8aa4<\/td>\n<td colspan=\"1\" rowspan=\"1\">Variable not interpolated, value is empty<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u5fd8\u8a18\u4f7f\u7528 <code>${{ }}<\/code> \u5305\u88f9<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u5728\u7bc4\u672c\u4e2d\u5c55\u793a\u6240\u6709\u4e0a\u4e0b\u6587\u6a21\u5f0f<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\u7bc4\u672c\u904e\u65bc\u8907\u96dc<\/td>\n<td colspan=\"1\" rowspan=\"1\">Contributor ignores template, issue incomplete<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u5305\u542b 20 \u500b\u4ee5\u4e0a\u6b04\u4f4d<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u4fdd\u6301\u6280\u80fd\u985e\u7bc4\u672c\u7cbe\u7c21\uff08\u6700\u591a 5-8 \u500b\u6b04\u4f4d\uff09<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\u7f3a\u5c11\u5fc5\u586b\u6b04\u4f4d<\/td>\n<td colspan=\"1\" rowspan=\"1\">Issue incomplete, missing key information<\/td>\n<td colspan=\"1\" rowspan=\"1\">Markdown \u7bc4\u672c\u7f3a\u5c11\u9a57\u8b49<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u4f7f\u7528\u5e36\u6709 <code>required: true<\/code> \u7684 YAML \u7bc4\u672c<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\u5de5\u4f5c\u6d41\u7a0b\u91cd\u8907<\/td>\n<td colspan=\"1\" rowspan=\"1\">Wasted CI time, high maintenance overhead<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u70ba CI \/ CodeQL \/ dependency review \u5206\u5225\u8a2d\u5b9a\u4e86\u7368\u7acb\u5de5\u4f5c\u6d41\u7a0b<\/td>\n<td colspan=\"1\" rowspan=\"1\">\u5728\u7bc4\u672c\u4e2d\u63d0\u4f9b\u6574\u5408\u65b9\u6848<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u5982\u679c\u4f60\u9047\u5230\u932f\u8aa4\uff0c\u8acb\u6aa2\u67e5 YAML \u6a94\u6848\u4e2d\u662f\u5426\u5b58\u5728\u554f\u984c\u3002\u78ba\u8a8d\u6240\u6709 Secrets \u548c\u8b8a\u6578\u90fd\u5df2\u6b63\u78ba\u8a2d\u5b9a\u3002\u67e5\u770b\u90e8\u7f72\u65e5\u8a8c\u901a\u5e38\u53ef\u4ee5\u5e6b\u52a9\u4f60\u5feb\u901f\u5b9a\u4f4d\u539f\u56e0\u3002\u53ca\u65e9\u4fee\u6b63\u9019\u4e9b\u5c0f\u554f\u984c\uff0c\u6703\u8b93\u4f60\u7684\u90e8\u7f72\u6d41\u7a0b\u66f4\u52a0\u9806\u66a2\u53ef\u9760\u3002<\/p>\n<div class=\"qc-divider-wrapper\">\n<div class=\"qc-divider\" style=\"border-top-style: solid; width: 100%; border-top-color: #d1d1d1;\"><\/div>\n<\/div>\n<p>\u4f60\u61c9\u8a72\u7d93\u5e38\u6e2c\u8a66\u90e8\u7f72\u6d41\u7a0b\uff0c\u4e26\u4fdd\u6301\u90e8\u7f72\u8173\u672c\u7684\u5b89\u5168\u6027\u3002\u4f60\u4e5f\u53ef\u4ee5\u5617\u8a66\u4e00\u4e9b\u66f4\u9032\u968e\u7684\u5de5\u5177\uff0c\u4f8b\u5982 AWS Code Deploy\u3001Heroku\u3001Zeit Now\u3001Netlify\u3001Travis CI\u3001CircleCI\u3001AWS ECS\u3001Docker Swarm \u548c Kubernetes\u3002\u5c0d\u65bc\u884c\u52d5\u7aef\u5c08\u6848\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 Bitrise \u548c Firebase\u3002\u70ba\u4f60\u7684 GitHub \u6574\u5408\u52a0\u5165\u901a\u77e5\u7cfb\u7d71\uff0c\u53ef\u4ee5\u5e6b\u52a9\u4f60\u66f4\u597d\u5730\u76e3\u63a7\u90e8\u7f72\u72c0\u614b\u3002\u9019\u4e9b\u5de5\u5177\u80fd\u5920\u5e6b\u52a9\u4f60\u7ba1\u7406 Git \u5de5\u4f5c\u6d41\u7a0b\uff0c\u4e26\u8b93\u4f60\u7684\u96f2\u7aef\u4f3a\u670d\u5668\u4fdd\u6301\u6700\u65b0\u3002\u81ea\u52d5\u5316\u6aa2\u67e5\u3001\u76e3\u63a7\u5de5\u5177\u548c\u8996\u89ba\u5316\u5100\u8868\u677f\uff0c\u6703\u70ba\u4f60\u5e36\u4f86\u66f4\u5f37\u7684\u638c\u63a7\u529b\u8207\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7576\u4f60\u628a\u7a0b\u5f0f\u78bc\u5f9e GitHub \u81ea\u52d5\u90e8\u7f72\u5230\u81ea\u5df1\u7684\u4f3a\u670d\u5668\u6642\uff0c\u53ef\u4ee5\u7bc0\u7701\u6642\u9593\u4e26\u907f\u514d\u51fa\u932f\u3002\u90e8\u7f72\u81ea\u52d5\u5316\u80fd\u5920\u5e36\u4f86\u66f4\u5feb\u7684\u56de\u994b\uff0c [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":2,"featured_media":31777,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[61],"tags":[11177,11178,259],"class_list":["post-31781","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hong-kong-dedicated-server-tc","tag-github-auto-deployment","tag-github-actions","tag-259"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u5982\u4f55\u4f7f\u7528 GitHub \u5c07\u7a0b\u5f0f\u78bc\u90e8\u7f72\u5230\u4f60\u7684\u4f3a\u670d\u5668<\/title>\n<meta name=\"description\" content=\"\u4f7f\u7528 GitHub Actions \u6216 Webhook \u5c07\u7a0b\u5f0f\u78bc\u81ea\u52d5\u90e8\u7f72\u5230\u4f60\u81ea\u5df1\u7684\u4f3a\u670d\u5668\u3002\u7c21\u5316\u66f4\u65b0\u6d41\u7a0b\u3001\u6e1b\u5c11\u932f\u8aa4\uff0c\u4e26\u63d0\u5347\u5de5\u4f5c\u6d41\u7a0b\u5b89\u5168\u6027\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/31781\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"company\" \/>\n<meta property=\"og:title\" content=\"\u5982\u4f55\u4f7f\u7528 GitHub \u5c07\u7a0b\u5f0f\u78bc\u90e8\u7f72\u5230\u4f60\u7684\u4f3a\u670d\u5668\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/31781\" \/>\n<meta property=\"og:site_name\" content=\"\u65b0\u5929\u57df\u4e92\u806f\" \/>\n<meta property=\"article:published_time\" content=\"2026-04-30T03:14:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-30T03:18:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.simcentric.com\/wp-content\/uploads\/2026\/04\/sim-blog-2026-04-30-blogA.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"619\" \/>\n\t<meta property=\"og:image:height\" content=\"340\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5982\u4f55\u4f7f\u7528 GitHub \u5c07\u7a0b\u5f0f\u78bc\u90e8\u7f72\u5230\u4f60\u7684\u4f3a\u670d\u5668","description":"\u4f7f\u7528 GitHub Actions \u6216 Webhook \u5c07\u7a0b\u5f0f\u78bc\u81ea\u52d5\u90e8\u7f72\u5230\u4f60\u81ea\u5df1\u7684\u4f3a\u670d\u5668\u3002\u7c21\u5316\u66f4\u65b0\u6d41\u7a0b\u3001\u6e1b\u5c11\u932f\u8aa4\uff0c\u4e26\u63d0\u5347\u5de5\u4f5c\u6d41\u7a0b\u5b89\u5168\u6027\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/31781","og_locale":"zh_TW","og_type":"company","og_title":"\u5982\u4f55\u4f7f\u7528 GitHub \u5c07\u7a0b\u5f0f\u78bc\u90e8\u7f72\u5230\u4f60\u7684\u4f3a\u670d\u5668","og_url":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/31781","og_site_name":"\u65b0\u5929\u57df\u4e92\u806f","article_published_time":"2026-04-30T03:14:13+00:00","article_modified_time":"2026-04-30T03:18:07+00:00","og_image":[{"width":619,"height":340,"url":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2026\/04\/sim-blog-2026-04-30-blogA.jpg","type":"image\/jpeg"}],"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/#article","isPartOf":{"@id":"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/"},"author":{"name":"Debbie Ng","@id":"https:\/\/simcentric.com\/tc\/#\/schema\/person\/0bfc8768eb7caacbfab4a0855d805626"},"headline":"\u5982\u4f55\u4f7f\u7528 GitHub \u5c07\u7a0b\u5f0f\u78bc\u90e8\u7f72\u5230\u4f60\u7684\u4f3a\u670d\u5668","datePublished":"2026-04-30T03:14:13+00:00","dateModified":"2026-04-30T03:18:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/"},"wordCount":209,"publisher":{"@id":"https:\/\/simcentric.com\/tc\/#organization"},"image":{"@id":"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/#primaryimage"},"thumbnailUrl":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2026\/04\/sim-blog-2026-04-30-blogA.jpg","keywords":["GitHub\u81ea\u52d5\u90e8\u7f72","GitHub \u64cd\u4f5c","\u9999\u6e2f\u4f3a\u670d\u5668"],"articleSection":["\u9999\u6e2f\u4f3a\u670d\u5668"],"inLanguage":"zh-HK"},{"@type":"WebPage","@id":"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/","url":"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/","name":"\u5982\u4f55\u4f7f\u7528 GitHub \u5c07\u7a0b\u5f0f\u78bc\u90e8\u7f72\u5230\u4f60\u7684\u4f3a\u670d\u5668","isPartOf":{"@id":"https:\/\/simcentric.com\/tc\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/#primaryimage"},"image":{"@id":"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/#primaryimage"},"thumbnailUrl":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2026\/04\/sim-blog-2026-04-30-blogA.jpg","datePublished":"2026-04-30T03:14:13+00:00","dateModified":"2026-04-30T03:18:07+00:00","description":"\u4f7f\u7528 GitHub Actions \u6216 Webhook \u5c07\u7a0b\u5f0f\u78bc\u81ea\u52d5\u90e8\u7f72\u5230\u4f60\u81ea\u5df1\u7684\u4f3a\u670d\u5668\u3002\u7c21\u5316\u66f4\u65b0\u6d41\u7a0b\u3001\u6e1b\u5c11\u932f\u8aa4\uff0c\u4e26\u63d0\u5347\u5de5\u4f5c\u6d41\u7a0b\u5b89\u5168\u6027\u3002","breadcrumb":{"@id":"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/#breadcrumb"},"inLanguage":"zh-HK","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/"]}]},{"@type":"ImageObject","inLanguage":"zh-HK","@id":"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/#primaryimage","url":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2026\/04\/sim-blog-2026-04-30-blogA.jpg","contentUrl":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2026\/04\/sim-blog-2026-04-30-blogA.jpg","width":619,"height":340,"caption":"GitHub code deployment to a server"},{"@type":"BreadcrumbList","@id":"https:\/\/www.simcentric.com\/tc\/hong-kong-dedicated-server-tc\/how-to-deploy-code-using-github-to-your-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.simcentric.com\/tc\/"},{"@type":"ListItem","position":2,"name":"\u5982\u4f55\u4f7f\u7528 GitHub \u5c07\u7a0b\u5f0f\u78bc\u90e8\u7f72\u5230\u4f60\u7684\u4f3a\u670d\u5668"}]},{"@type":"WebSite","@id":"https:\/\/simcentric.com\/tc\/#website","url":"https:\/\/simcentric.com\/tc\/","name":"Simcentric Solutions","description":"","publisher":{"@id":"https:\/\/simcentric.com\/tc\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/simcentric.com\/tc\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-HK"},{"@type":"Organization","@id":"https:\/\/simcentric.com\/tc\/#organization","name":"Simcentric Solutions","url":"https:\/\/simcentric.com\/tc\/","logo":{"@type":"ImageObject","inLanguage":"zh-HK","@id":"https:\/\/simcentric.com\/tc\/#\/schema\/logo\/image\/","url":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2023\/06\/sim-logo-2023.png","contentUrl":"https:\/\/www.simcentric.com\/wp-content\/uploads\/2023\/06\/sim-logo-2023.png","width":800,"height":222,"caption":"Simcentric Solutions"},"image":{"@id":"https:\/\/simcentric.com\/tc\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/simcentric.com\/tc\/#\/schema\/person\/0bfc8768eb7caacbfab4a0855d805626","name":"Debbie Ng","image":{"@type":"ImageObject","inLanguage":"zh-HK","@id":"https:\/\/secure.gravatar.com\/avatar\/9f3420f60d27329ed6e921ddaae5206353d0a7414d1abb6f1f0b32b4fd849965?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9f3420f60d27329ed6e921ddaae5206353d0a7414d1abb6f1f0b32b4fd849965?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9f3420f60d27329ed6e921ddaae5206353d0a7414d1abb6f1f0b32b4fd849965?s=96&d=mm&r=g","caption":"Debbie Ng"}}]}},"_links":{"self":[{"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/31781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/comments?post=31781"}],"version-history":[{"count":2,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/31781\/revisions"}],"predecessor-version":[{"id":31784,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/posts\/31781\/revisions\/31784"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/media\/31777"}],"wp:attachment":[{"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/media?parent=31781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/categories?post=31781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.simcentric.com\/tc\/wp-json\/wp\/v2\/tags?post=31781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}