{"id":200817,"date":"2020-11-22T23:42:43","date_gmt":"2020-11-22T15:42:43","guid":{"rendered":"http:\/\/4563.org\/?p=200817"},"modified":"2020-11-22T23:42:43","modified_gmt":"2020-11-22T15:42:43","slug":"hexo-%e4%bd%bf%e7%94%a8-github-actions-%e8%87%aa%e5%8a%a8%e5%8f%91%e5%b8%83%e8%87%b3-github-pages-%e6%97%b6%ef%bc%8c%e7%94%9f%e6%88%90%e7%9a%84-html-%e9%a1%b5%e9%9d%a2%e7%a9%ba%e7%99%bd%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=200817","title":{"rendered":"Hexo \u4f7f\u7528 Github Actions \u81ea\u52a8\u53d1\u5e03\u81f3 Github Pages \u65f6\uff0c\u751f\u6210\u7684 html \u9875\u9762\u7a7a\u767d\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Hexo \u4f7f\u7528 Github Actions \u81ea\u52a8\u53d1\u5e03\u81f3 Github Pages \u65f6\uff0c\u751f\u6210\u7684 html \u9875\u9762\u7a7a\u767d\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : s609926202 <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4ee5\u4e0b\u662f hexo \u914d\u7f6e\u6587\u4ef6_config.yml \u90e8\u7f72\u914d\u7f6e\u9879\uff1a<\/p>\n<pre><code>deploy:   type: git   repo: [email&#160;protected]:xx\/xx.github.io.git   branch: main <\/code><\/pre>\n<p>\u4ee5\u4e0b\u662f.gitignore \u6587\u4ef6\u5185\u5bb9\uff1a<\/p>\n<pre><code>.DS_Store Thumbs.db db.json *.log node_modules\/ public\/ .deploy*\/ <\/code><\/pre>\n<p>\u4ee5\u4e0b\u662f Github Actions \u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code>name: CI  on:   push:     branches:       - main  jobs:   build:     runs-on: ubuntu-latest # \u5728\u6700\u65b0\u7248\u7684 Ubuntu \u7cfb\u7edf\u4e0b\u8fd0\u884c          steps:     - name: Checkout # \u5c06\u4ed3\u5e93\u5185 master \u5206\u652f\u7684\u5185\u5bb9\u4e0b\u8f7d\u5230\u5de5\u4f5c\u76ee\u5f55       uses: actions\/[email&#160;protected] # \u811a\u672c\u6765\u81ea https:\/\/github.com\/actions\/checkout            - name: Use Node.js 10.x # \u914d\u7f6e Node \u73af\u5883       uses: actions\/[email&#160;protected] # \u914d\u7f6e\u811a\u672c\u6765\u81ea https:\/\/github.com\/actions\/setup-node       with:         node-version: \"10.x\"          - name: Setup Hexo env       env:         ACTION_DEPLOY_KEY: ${{ secrets.HEXO_DEPLOY_PRI }}       run: |         # set up private key for deploy         mkdir -p ~\/.ssh\/         echo \"$ACTION_DEPLOY_KEY\" | tr -d 'r' &gt; ~\/.ssh\/id_rsa # \u914d\u7f6e\u79d8\u94a5         chmod 600 ~\/.ssh\/id_rsa         ssh-keyscan github.com &gt;&gt; ~\/.ssh\/known_hosts                  # set git infomation         git config --global user.name 'xx'         git config --global user.email '[email&#160;protected]'         # install dependencies         npm install -g hexo-cli         npm install        - name: Deploy       run: |         hexo clean         hexo generate         hexo deploy # \u6267\u884c\u90e8\u7f72\u7a0b\u5e8f <\/code><\/pre>\n<p>Github Pages \u4e3b\u5206\u652f\u4e3a main \u5206\u652f\uff0c\u4e5f\u53ea\u6709\u8fd9\u4e00\u4e2a\u5206\u652f\u3002\u4f46\u662f push Hexo \u5230 Github\uff0c\u81ea\u52a8\u90e8\u7f72\u540e\u63a8\u9001\u5230 xx.github.io \u4ed3\u5e93\u7684 html \u5185\u5bb9\u5374\u4e3a\u7a7a\uff0c\u672c\u5730 hexo server \u540e\u9884\u89c8\u6b63\u5e38\u3002<\/p>\n<p>\u8bf7\u52ff\u9700\u8981\u5982\u4f55\u6539\u8fdb\u4e0b\uff0c\u53ef\u4ee5\u5b9e\u73b0\u6b63\u786e\u7684\u81ea\u52a8\u90e8\u7f72\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>0<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Hexo \u4f7f\u7528 Github Ac&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/200817"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=200817"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/200817\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=200817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=200817"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=200817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}