{"id":112641,"date":"2026-10-04T10:41:03","date_gmt":"2026-10-04T02:41:03","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/112641.html"},"modified":"2026-10-04T10:41:03","modified_gmt":"2026-10-04T02:41:03","slug":"deploy-sh-%e9%83%a8%e7%bd%b2%e8%84%9a%e6%9c%ac%ef%bc%9a%e5%81%a5%e5%ba%b7%e6%a3%80%e6%9f%a5-%e8%87%aa%e5%8a%a8%e5%9b%9e%e6%bb%9a","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/112641.html","title":{"rendered":"deploy.sh \u90e8\u7f72\u811a\u672c\uff1a\u5065\u5eb7\u68c0\u67e5 + \u81ea\u52a8\u56de\u6eda"},"content":{"rendered":"<p>\u80cc\u666f<br \/>\n\u4e0a\u4e00\u7bc7\u914d\u7f6e\u4e86 GitHub Actions&#xff0c;push \u540e\u81ea\u52a8 SSH \u5230\u670d\u52a1\u5668\u6267\u884c deploy.sh\u3002<\/p>\n<p>\u4f46\u6700\u521d\u7684\u811a\u672c\u53ea\u6709\u4e09\u884c&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">cd<\/span> \/home\/ubuntu\/app<br \/>\n<span class=\"token function\">git<\/span> pull<br \/>\n<span class=\"token function\">docker<\/span> compose up <span class=\"token parameter variable\">-d<\/span> <span class=\"token parameter variable\">&#8211;build<\/span><\/p>\n<p>\u95ee\u9898&#xff1a;\u5982\u679c\u65b0\u4ee3\u7801\u6709 bug&#xff0c;\u5bb9\u5668\u8d77\u4e0d\u6765\u2014\u2014\u7f51\u7ad9\u76f4\u63a5\u6302&#xff0c;\u800c\u4e14\u4e0d\u4f1a\u81ea\u52a8\u9000\u56de\u65e7\u7248\u672c\u3002<\/p>\n<p>\u539f\u56e0<br \/>\n\u90e8\u7f72\u811a\u672c\u53ea\u505a\u4e86&#034;\u5f80\u524d&#034;&#xff0c;\u6ca1\u505a&#034;\u5f80\u540e&#034;\u3002<\/p>\n<p>\u4e00\u4e2a\u80fd\u7528\u7684\u90e8\u7f72\u811a\u672c&#xff0c;\u81f3\u5c11\u8981\u53055\u4e2a\u73af\u8282&#xff1a;<\/p>\n<h3>1. \u90e8\u7f72\u811a\u672c\u7684\u5b8c\u6574\u73af\u8282<\/h3>\n<p>\u4e00\u4e2a\u53ef\u9760\u7684\u90e8\u7f72\u811a\u672c&#xff0c;\u81f3\u5c11\u8981\u5305\u542b\u4ee5\u4e0b\u4e94\u4e2a\u73af\u8282&#xff1a;<\/p>\n<table>\n<tr>\u73af\u8282\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>\u8bb0\u5f55\u5f53\u524d\u7248\u672c<\/td>\n<td>\u51fa\u9519\u65f6\u77e5\u9053\u56de\u6eda\u5230\u54ea<\/td>\n<\/tr>\n<tr>\n<td>\u62c9\u53d6\u65b0\u4ee3\u7801<\/td>\n<td>\u66f4\u65b0\u5230\u6700\u65b0<\/td>\n<\/tr>\n<tr>\n<td>\u6784\u5efa&#043;\u542f\u52a8<\/td>\n<td>\u5e94\u7528\u65b0\u7248\u672c<\/td>\n<\/tr>\n<tr>\n<td>\u5065\u5eb7\u68c0\u67e5<\/td>\n<td>\u9a8c\u8bc1\u670d\u52a1\u771f\u7684\u80fd\u7528\u4e86<\/td>\n<\/tr>\n<tr>\n<td>\u5931\u8d25\u56de\u6eda<\/td>\n<td>\u5065\u5eb7\u68c0\u67e5\u4e0d\u8fc7&#xff0c;\u9000\u56de\u65e7\u7248\u672c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5b8c\u6574\u811a\u672c<\/p>\n<p><span class=\"token shebang important\">#!\/bin\/bash<\/span><br \/>\n<span class=\"token builtin class-name\">set<\/span> <span class=\"token parameter variable\">-euo<\/span> pipefail<\/p>\n<p><span class=\"token assign-left variable\">PROJECT_DIR<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;\/home\/ubuntu\/app&#034;<\/span><br \/>\n<span class=\"token assign-left variable\">HEALTH_URL<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;http:\/\/127.0.0.1:8081\/api\/health&#034;<\/span><\/p>\n<p><span class=\"token builtin class-name\">cd<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">$PROJECT_DIR<\/span>&#034;<\/span><\/p>\n<p><span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;&#x1f680; \u5f00\u59cb\u90e8\u7f72 &#8211; <span class=\"token variable\"><span class=\"token variable\">$(<\/span><span class=\"token function\">date<\/span> <span class=\"token string\">&#039;&#043;%F %T&#039;<\/span><span class=\"token variable\">)<\/span><\/span>&#034;<\/span><\/p>\n<p><span class=\"token comment\"># 1. \u8bb0\u5f55\u5f53\u524d\u7248\u672c<\/span><br \/>\n<span class=\"token assign-left variable\">LAST_GOOD<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token variable\"><span class=\"token variable\">$(<\/span><span class=\"token function\">git<\/span> rev-parse HEAD<span class=\"token variable\">)<\/span><\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;&#x1f4cc; \u5f53\u524d\u7248\u672c: <span class=\"token variable\">${LAST_GOOD<span class=\"token operator\">:<\/span>0<span class=\"token operator\">:<\/span>8}<\/span>&#034;<\/span><\/p>\n<p><span class=\"token comment\"># 2. \u56de\u6eda\u51fd\u6570<\/span><br \/>\n<span class=\"token function-name function\">rollback<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;\u26a0\ufe0f \u90e8\u7f72\u5931\u8d25&#xff0c;\u56de\u6eda\u5230 <span class=\"token variable\">${LAST_GOOD<span class=\"token operator\">:<\/span>0<span class=\"token operator\">:<\/span>8}<\/span>&#034;<\/span><br \/>\n    <span class=\"token function\">git<\/span> reset <span class=\"token parameter variable\">&#8211;hard<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">$LAST_GOOD<\/span>&#034;<\/span><br \/>\n    <span class=\"token function\">docker<\/span> compose up <span class=\"token parameter variable\">-d<\/span> <span class=\"token parameter variable\">&#8211;build<\/span><br \/>\n    <span class=\"token builtin class-name\">exit<\/span> <span class=\"token number\">1<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token builtin class-name\">trap<\/span> rollback ERR<\/p>\n<p><span class=\"token comment\"># 3. \u62c9\u53d6\u6700\u65b0\u4ee3\u7801<\/span><br \/>\n<span class=\"token function\">git<\/span> fetch <span class=\"token parameter variable\">&#8211;all<\/span><br \/>\n<span class=\"token function\">git<\/span> reset <span class=\"token parameter variable\">&#8211;hard<\/span> origin\/main<br \/>\n<span class=\"token assign-left variable\">NEW_COMMIT<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token variable\"><span class=\"token variable\">$(<\/span><span class=\"token function\">git<\/span> rev-parse <span class=\"token parameter variable\">&#8211;short<\/span> HEAD<span class=\"token variable\">)<\/span><\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;&#x1f4cc; \u76ee\u6807\u7248\u672c: <span class=\"token variable\">$NEW_COMMIT<\/span>&#034;<\/span><\/p>\n<p><span class=\"token comment\"># 4. \u6784\u5efa &#043; \u542f\u52a8<\/span><br \/>\n<span class=\"token function\">docker<\/span> compose up <span class=\"token parameter variable\">-d<\/span> <span class=\"token parameter variable\">&#8211;build<\/span><\/p>\n<p><span class=\"token comment\"># 5. \u5065\u5eb7\u68c0\u67e5&#xff08;\u91cd\u8bd5 5 \u6b21&#xff09;<\/span><br \/>\n<span class=\"token keyword\">for<\/span> <span class=\"token for-or-select variable\">i<\/span> <span class=\"token keyword\">in<\/span> <span class=\"token variable\"><span class=\"token variable\">$(<\/span><span class=\"token function\">seq<\/span> <span class=\"token number\">1<\/span> <span class=\"token number\">5<\/span><span class=\"token variable\">)<\/span><\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">do<\/span><br \/>\n    <span class=\"token function\">sleep<\/span> <span class=\"token number\">3<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-fsS<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">$HEALTH_URL<\/span>&#034;<\/span> <span class=\"token operator\">&gt;<\/span> \/dev\/null <span class=\"token operator\"><span class=\"token file-descriptor important\">2<\/span>&gt;<\/span><span class=\"token file-descriptor important\">&amp;1<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">then<\/span><br \/>\n        <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;\u2705 \u5065\u5eb7\u68c0\u67e5\u901a\u8fc7&#xff08;\u7b2c <span class=\"token variable\">$i<\/span> \u6b21&#xff09;&#034;<\/span><br \/>\n        <span class=\"token builtin class-name\">exit<\/span> <span class=\"token number\">0<\/span><br \/>\n    <span class=\"token keyword\">fi<\/span><br \/>\n    <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;  \u7b2c <span class=\"token variable\">$i<\/span> \u6b21\u5931\u8d25&#xff0c;\u7b49\u5f85 3 \u79d2&#8230;&#034;<\/span><br \/>\n<span class=\"token keyword\">done<\/span><\/p>\n<p><span class=\"token comment\"># 6. \u5065\u5eb7\u68c0\u67e5\u5931\u8d25&#xff0c;\u56de\u6eda<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;\u274c \u5065\u5eb7\u68c0\u67e5 5 \u6b21\u5168\u5931\u8d25&#034;<\/span><br \/>\nrollback<\/p>\n<p>\u5173\u952e\u70b9\u89e3\u8bfb<br \/>\nset -euo pipefail \u2014\u2014 \u811a\u672c\u7684&#034;\u5b89\u5168\u6a21\u5f0f&#034;&#xff1a;<\/p>\n<p>-e&#xff1a;\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u7acb\u523b\u9000\u51fa<\/p>\n<p>-u&#xff1a;\u4f7f\u7528\u672a\u5b9a\u4e49\u53d8\u91cf\u62a5\u9519<\/p>\n<p>-o pipefail&#xff1a;\u7ba1\u9053\u4e2d\u4efb\u4f55\u4e00\u73af\u5931\u8d25\u90fd\u7b97\u5931\u8d25<\/p>\n<p>\u6ca1\u6709\u8fd9\u4e09\u6761&#xff0c;\u811a\u672c\u4f1a&#034;\u5047\u88c5\u6210\u529f&#034;\u2014\u2014\u4e2d\u95f4\u547d\u4ee4\u6302\u4e86\u5b83\u8fd8\u7ee7\u7eed\u5f80\u4e0b\u8dd1\u3002<\/p>\n<p>trap rollback ERR \u2014\u2014 \u6355\u83b7\u4efb\u4f55\u9519\u8bef\u89e6\u53d1\u56de\u6eda&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">trap<\/span> rollback ERR<\/p>\n<p>\u4e4b\u540e\u811a\u672c\u91cc\u4efb\u4f55\u4e00\u6761\u547d\u4ee4\u5931\u8d25&#xff0c;\u90fd\u4f1a\u81ea\u52a8\u8c03 rollback()\u3002<\/p>\n<p>\u5065\u5eb7\u68c0\u67e5\u91cd\u8bd5 5 \u6b21 \u2014\u2014 \u4e0d\u8981\u53ea\u68c0\u67e5\u4e00\u6b21&#xff1a;<\/p>\n<p><span class=\"token keyword\">for<\/span> <span class=\"token for-or-select variable\">i<\/span> <span class=\"token keyword\">in<\/span> <span class=\"token variable\"><span class=\"token variable\">$(<\/span><span class=\"token function\">seq<\/span> <span class=\"token number\">1<\/span> <span class=\"token number\">5<\/span><span class=\"token variable\">)<\/span><\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">do<\/span><br \/>\n    <span class=\"token function\">sleep<\/span> <span class=\"token number\">3<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> <span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-fsS<\/span> <span class=\"token string\">&#034;<span class=\"token variable\">$HEALTH_URL<\/span>&#034;<\/span> <span class=\"token operator\">&gt;<\/span> \/dev\/null <span class=\"token operator\"><span class=\"token file-descriptor important\">2<\/span>&gt;<\/span><span class=\"token file-descriptor important\">&amp;1<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">then<\/span><br \/>\n        <span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;\u2705 \u901a\u8fc7&#034;<\/span><br \/>\n        <span class=\"token builtin class-name\">exit<\/span> <span class=\"token number\">0<\/span><br \/>\n    <span class=\"token keyword\">fi<\/span><br \/>\n<span class=\"token keyword\">done<\/span><\/p>\n<p>\u5bb9\u5668\u542f\u52a8\u540e\u9700\u8981\u51e0\u79d2\u949f\u624d\u80fd\u54cd\u5e94&#xff0c;\u7ed9 15 \u79d2\u7684\u7a97\u53e3&#xff0c;\u6bd4\u53ea\u68c0\u67e5\u4e00\u6b21\u7a33\u5f97\u591a\u3002<\/p>\n<p>\u4e09\u4e2a\u5751<br \/>\n\u5751 1&#xff1a;\u6ca1\u52a0 set -e&#xff0c;\u811a\u672c&#034;\u5047\u88c5\u6210\u529f&#034;<\/p>\n<p>\u6bd4\u5982 docker compose up -d &#8211;build \u5931\u8d25\u4e86&#xff0c;\u811a\u672c\u4e0d\u4f1a\u4e2d\u65ad&#xff0c;\u8fd8\u4f1a\u7ee7\u7eed\u6267\u884c\u5065\u5eb7\u68c0\u67e5\u3001\u8f93\u51fa&#034;\u90e8\u7f72\u6210\u529f&#034;\u3002\u8fd9\u79cd\u811a\u672c\u6bd4\u6ca1\u6709\u66f4\u5371\u9669\u2014\u2014\u4f60\u4ee5\u4e3a\u90e8\u7f72\u6210\u529f\u4e86&#xff0c;\u5176\u5b9e\u6ca1\u6709\u3002<\/p>\n<p>\u5751 2&#xff1a;\u5065\u5eb7\u68c0\u67e5\u53ea\u8dd1\u4e00\u6b21<\/p>\n<p>curl \u4e00\u6b21\u5931\u8d25\u5c31\u56de\u6eda&#xff0c;\u592a\u6fc0\u8fdb\u3002\u5bb9\u5668\u542f\u52a8\u6709\u5ef6\u8fdf&#xff0c;\u8981\u91cd\u8bd5\u51e0\u6b21\u3002\u628a 5 \u6b21 \u00d7 3 \u79d2\u7684\u7a97\u53e3\u5f53\u6210\u6807\u914d\u3002<\/p>\n<p>\u5751 3&#xff1a;\u56de\u6eda\u7528\u7684\u662f git reset &#8211;hard<\/p>\n<p>\u8fd9\u4f1a\u628a\u670d\u52a1\u5668\u4e0a\u7684\u4ee3\u7801\u9000\u56de\u65e7\u7248\u672c\u3002\u4f46\u5982\u679c\u4e0b\u4e00\u4e2a push \u53c8\u62c9\u6700\u65b0\u4ee3\u7801&#xff0c;\u574f\u4ee3\u7801\u53c8\u56de\u6765\u4e86\u3002\u771f\u6b63\u7684\u56de\u6eda\u5e94\u8be5\u662f git revert \u540e push \u5230 GitHub\u2014\u2014\u4f46\u90a3\u9700\u8981 deploy key \u6709\u5199\u6743\u9650\u3002<\/p>\n<p>\u7b80\u5316\u7248&#xff1a;\u76ee\u524d reset &#8211;hard \u591f\u7528\u3002\u7b49\u6709\u771f\u5b9e\u7528\u6237\u4e86&#xff0c;\u518d\u4e0a&#034;revert &#043; push&#034;\u65b9\u6848\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f<br \/>\n\u4e0a\u4e00\u7bc7\u914d\u7f6e\u4e86 GitHub Actions&#xff0c;push \u540e\u81ea\u52a8 SSH \u5230\u670d\u52a1\u5668\u6267\u884c deploy.sh\u3002<br \/>\n\u4f46\u6700\u521d\u7684\u811a\u672c\u53ea\u6709\u4e09\u884c&#xff1a;<br \/>\ncd \/home\/ubuntu\/app<br \/>\ngit pull<br \/>\ndocker compose up -d &#8211;build\u95ee\u9898&#xff1a;\u5982\u679c\u65b0\u4ee3\u7801\u6709 bug&#xff0c;\u5bb9\u5668\u8d77\u4e0d\u6765\u2014\u2014\u7f51\u7ad9\u76f4\u63a5\u6302&#xff0c;\u800c\u4e14\u4e0d\u4f1a\u81ea\u52a8\u9000\u56de\u65e7\u7248\u672c\u3002<br \/>\n\u539f\u56e0<br \/>\n\u90e8\u7f72\u811a\u672c\u53ea\u505a\u4e86\\&#8221;\u5f80\u524d\\&#8221;&#xff0c;\u6ca1\u505a\\&#8221;\u5f80\u540e\\&#8221;\u3002<br \/>\n\u4e00\u4e2a\u80fd\u7528\u7684\u90e8\u7f72\u811a\u672c&amp;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[97,526,43,44],"topic":[],"class_list":["post-112641","post","type-post","status-publish","format-standard","hentry","category-server","tag-97","tag-526","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>deploy.sh \u90e8\u7f72\u811a\u672c\uff1a\u5065\u5eb7\u68c0\u67e5 + \u81ea\u52a8\u56de\u6eda - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\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.wsisp.com\/helps\/112641.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"deploy.sh \u90e8\u7f72\u811a\u672c\uff1a\u5065\u5eb7\u68c0\u67e5 + \u81ea\u52a8\u56de\u6eda - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u80cc\u666f \u4e0a\u4e00\u7bc7\u914d\u7f6e\u4e86 GitHub Actions&#xff0c;push \u540e\u81ea\u52a8 SSH \u5230\u670d\u52a1\u5668\u6267\u884c deploy.sh\u3002 \u4f46\u6700\u521d\u7684\u811a\u672c\u53ea\u6709\u4e09\u884c&#xff1a; cd \/home\/ubuntu\/app git pull docker compose up -d --build\u95ee\u9898&#xff1a;\u5982\u679c\u65b0\u4ee3\u7801\u6709 bug&#xff0c;\u5bb9\u5668\u8d77\u4e0d\u6765\u2014\u2014\u7f51\u7ad9\u76f4\u63a5\u6302&#xff0c;\u800c\u4e14\u4e0d\u4f1a\u81ea\u52a8\u9000\u56de\u65e7\u7248\u672c\u3002 \u539f\u56e0 \u90e8\u7f72\u811a\u672c\u53ea\u505a\u4e86&quot;\u5f80\u524d&quot;&#xff0c;\u6ca1\u505a&quot;\u5f80\u540e&quot;\u3002 \u4e00\u4e2a\u80fd\u7528\u7684\u90e8\u7f72\u811a\u672c&amp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/112641.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-04T02:41:03+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/112641.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/112641.html\",\"name\":\"deploy.sh \u90e8\u7f72\u811a\u672c\uff1a\u5065\u5eb7\u68c0\u67e5 + \u81ea\u52a8\u56de\u6eda - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-04T02:41:03+00:00\",\"dateModified\":\"2026-10-04T02:41:03+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/112641.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/112641.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/112641.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"deploy.sh \u90e8\u7f72\u811a\u672c\uff1a\u5065\u5eb7\u68c0\u67e5 + \u81ea\u52a8\u56de\u6eda\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"deploy.sh \u90e8\u7f72\u811a\u672c\uff1a\u5065\u5eb7\u68c0\u67e5 + \u81ea\u52a8\u56de\u6eda - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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.wsisp.com\/helps\/112641.html","og_locale":"zh_CN","og_type":"article","og_title":"deploy.sh \u90e8\u7f72\u811a\u672c\uff1a\u5065\u5eb7\u68c0\u67e5 + \u81ea\u52a8\u56de\u6eda - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u80cc\u666f \u4e0a\u4e00\u7bc7\u914d\u7f6e\u4e86 GitHub Actions&#xff0c;push \u540e\u81ea\u52a8 SSH \u5230\u670d\u52a1\u5668\u6267\u884c deploy.sh\u3002 \u4f46\u6700\u521d\u7684\u811a\u672c\u53ea\u6709\u4e09\u884c&#xff1a; cd \/home\/ubuntu\/app git pull docker compose up -d --build\u95ee\u9898&#xff1a;\u5982\u679c\u65b0\u4ee3\u7801\u6709 bug&#xff0c;\u5bb9\u5668\u8d77\u4e0d\u6765\u2014\u2014\u7f51\u7ad9\u76f4\u63a5\u6302&#xff0c;\u800c\u4e14\u4e0d\u4f1a\u81ea\u52a8\u9000\u56de\u65e7\u7248\u672c\u3002 \u539f\u56e0 \u90e8\u7f72\u811a\u672c\u53ea\u505a\u4e86\"\u5f80\u524d\"&#xff0c;\u6ca1\u505a\"\u5f80\u540e\"\u3002 \u4e00\u4e2a\u80fd\u7528\u7684\u90e8\u7f72\u811a\u672c&amp;","og_url":"https:\/\/www.wsisp.com\/helps\/112641.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-04T02:41:03+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/112641.html","url":"https:\/\/www.wsisp.com\/helps\/112641.html","name":"deploy.sh \u90e8\u7f72\u811a\u672c\uff1a\u5065\u5eb7\u68c0\u67e5 + \u81ea\u52a8\u56de\u6eda - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-04T02:41:03+00:00","dateModified":"2026-10-04T02:41:03+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/112641.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/112641.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/112641.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"deploy.sh \u90e8\u7f72\u811a\u672c\uff1a\u5065\u5eb7\u68c0\u67e5 + \u81ea\u52a8\u56de\u6eda"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/112641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=112641"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/112641\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=112641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=112641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=112641"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=112641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}