Update README.md
This commit is contained in:
1 parent
964b803d2b
commit
9635422253
1 file changed
+52
@@ -101,6 +101,58 @@ deploy to s3:
|
||||
- aws s3 rm s3://$S3_BUCKET --recursive
|
||||
- aws s3 cp public s3://$S3_BUCKET --recursive
|
||||
```
|
||||
### GitHub Action
|
||||
In case you want to deploy your website via GitHub Action, here are some of the code you can use:
|
||||
```yaml
|
||||
# workflow name
|
||||
name: Hexo Blog CI
|
||||
|
||||
# master branch on push, auto run
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# check it to your workflow can access it
|
||||
# from: https://github.com/actions/checkout
|
||||
- name: Checkout Repository master branch
|
||||
uses: actions/checkout@master
|
||||
|
||||
# from: https://github.com/actions/setup-node
|
||||
- name: Setup Node.js 10.x
|
||||
uses: actions/setup-node@master
|
||||
with:
|
||||
node-version: "10.x"
|
||||
|
||||
- name: Setup Hexo Dependencies
|
||||
run: |
|
||||
npm install hexo-cli -g
|
||||
npm install
|
||||
|
||||
- name: Setup Deploy Private Key
|
||||
env:
|
||||
HEXO_DEPLOY_PRIVATE_KEY: ${{ secrets.HEXO_DEPLOY_PRIVATE_KEY }}
|
||||
run: |
|
||||
mkdir -p ~/.ssh/
|
||||
echo "$HEXO_DEPLOY_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Setup Git Infomation
|
||||
run: |
|
||||
git config --global user.name '名字'
|
||||
git config --global user.email '邮件'
|
||||
- name: Deploy Hexo
|
||||
run: |
|
||||
hexo clean
|
||||
hexo generate
|
||||
hexo deploy
|
||||
```
|
||||
|
||||
### Testing our builds before pushing content to the `master` branch
|
||||
What if we want to test our builds in another branch before afecting `master`?
|
||||
|
||||
Reference in new issue
Block a user