fix: spelling error in README.md
This commit is contained in:
1 parent
4359d9cd1b
commit
c9f7f11e2d
1 file changed
+54
-54
@@ -11,12 +11,12 @@ View site: https://angulareportfolio.pw
|
|||||||
- Package - view [`package.json`]
|
- Package - view [`package.json`]
|
||||||
## Requirements
|
## Requirements
|
||||||
[Hexo] is a [SSG] powered by [NodeJS][node]. So we'll need this first:
|
[Hexo] is a [SSG] powered by [NodeJS][node]. So we'll need this first:
|
||||||
- Node JS environment
|
- Node JS environment
|
||||||
- [npm] (package manager)
|
- [npm] (package manager)
|
||||||
- [git] core
|
- [git] core
|
||||||
## Script
|
## Script
|
||||||
We already have a Node image on [Docker Library][docker-lib], so we'll require it to run our script on the
|
We already have a Node image on [Docker Library][docker-lib], so we'll require it to run our script on the
|
||||||
environment of NodeJS.
|
environment of NodeJS.
|
||||||
|
|
||||||
This will bring `npm` and `git` core with it: `image: node:latest`
|
This will bring `npm` and `git` core with it: `image: node:latest`
|
||||||
|
|
||||||
@@ -34,13 +34,13 @@ We'll set the the `npm` modules and its dependecies as a `cache` to speed up our
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- node_modules/
|
- node_modules/
|
||||||
```
|
```
|
||||||
### GitLab-CI
|
### GitLab-CI
|
||||||
We need to prepare our `gitlab-ci.yml` configuration file to do as we described previously.
|
We need to prepare our `gitlab-ci.yml` configuration file to do as we described previously.
|
||||||
|
|
||||||
We'll also need a `pages` job and finally a `public` folder with our `artifacts`, afecting only our `master` branch:
|
We'll also need a `pages` job and finally a `public` folder with our `artifacts`, affecting only our `master` branch:
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -48,7 +48,7 @@ We'll also need a `pages` job and finally a `public` folder with our `artifacts`
|
|||||||
image: node:latest
|
image: node:latest
|
||||||
# add 'node_modules' to cache for speeding up builds
|
# add 'node_modules' to cache for speeding up builds
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- node_modules/ # Node modules and dependencies
|
- node_modules/ # Node modules and dependencies
|
||||||
before_script:
|
before_script:
|
||||||
- npm install -g hexo-cli # Install Hexo itself
|
- npm install -g hexo-cli # Install Hexo itself
|
||||||
@@ -63,7 +63,7 @@ pages:
|
|||||||
- hexo generate # Hexo generate Static Site
|
- hexo generate # Hexo generate Static Site
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
only:
|
only:
|
||||||
- master # this job will affect only the 'master' branch
|
- master # this job will affect only the 'master' branch
|
||||||
```
|
```
|
||||||
@@ -77,7 +77,7 @@ build website:
|
|||||||
image: node:latest
|
image: node:latest
|
||||||
# add 'node_modules' to cache for speeding up builds
|
# add 'node_modules' to cache for speeding up builds
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- node_modules/ # Node modules and dependencies
|
- node_modules/ # Node modules and dependencies
|
||||||
script:
|
script:
|
||||||
- npm install -g hexo-cli # Install Hexo itself
|
- npm install -g hexo-cli # Install Hexo itself
|
||||||
@@ -107,49 +107,49 @@ In case you want to deploy your website via GitHub Action, here are some of the
|
|||||||
name: Hexo Blog CI
|
name: Hexo Blog CI
|
||||||
|
|
||||||
# master branch on push, auto run
|
# master branch on push, auto run
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-hexo:
|
build-hexo:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# check it to your workflow can access it
|
# check it to your workflow can access it
|
||||||
# from: https://github.com/actions/checkout
|
# from: https://github.com/actions/checkout
|
||||||
- name: Checkout Repository master branch
|
- name: Checkout Repository master branch
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@master
|
||||||
|
|
||||||
# from: https://github.com/actions/setup-node
|
# from: https://github.com/actions/setup-node
|
||||||
- name: Setup Node.js 10.x
|
- name: Setup Node.js 10.x
|
||||||
uses: actions/setup-node@master
|
uses: actions/setup-node@master
|
||||||
with:
|
with:
|
||||||
node-version: "10.x"
|
node-version: "10.x"
|
||||||
|
|
||||||
- name: Setup Hexo Dependencies
|
- name: Setup Hexo Dependencies
|
||||||
run: |
|
run: |
|
||||||
npm install hexo-cli -g
|
npm install hexo-cli -g
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
- name: Setup Deploy Private Key
|
- name: Setup Deploy Private Key
|
||||||
env:
|
env:
|
||||||
HEXO_DEPLOY_PRIVATE_KEY: ${{ secrets.HEXO_DEPLOY_PRIVATE_KEY }}
|
HEXO_DEPLOY_PRIVATE_KEY: ${{ secrets.HEXO_DEPLOY_PRIVATE_KEY }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh/
|
mkdir -p ~/.ssh/
|
||||||
echo "$HEXO_DEPLOY_PRIVATE_KEY" > ~/.ssh/id_rsa
|
echo "$HEXO_DEPLOY_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||||
chmod 600 ~/.ssh/id_rsa
|
chmod 600 ~/.ssh/id_rsa
|
||||||
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
- name: Setup Git Infomation
|
- name: Setup Git Infomation
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name '名字'
|
git config --global user.name '名字'
|
||||||
git config --global user.email '邮件'
|
git config --global user.email '邮件'
|
||||||
- name: Deploy Hexo
|
- name: Deploy Hexo
|
||||||
run: |
|
run: |
|
||||||
hexo clean
|
hexo clean
|
||||||
hexo generate
|
hexo generate
|
||||||
hexo deploy
|
hexo deploy
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: 🚚 Get latest code
|
- name: 🚚 Get latest code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: 📂 Sync files
|
- name: 📂 Sync files
|
||||||
uses: SamKirkland/FTP-Deploy-Action@4.1.0
|
uses: SamKirkland/FTP-Deploy-Action@4.1.0
|
||||||
with:
|
with:
|
||||||
@@ -181,65 +181,65 @@ jobs:
|
|||||||
name: Hexo Blog CI
|
name: Hexo Blog CI
|
||||||
|
|
||||||
# master branch on push, auto run
|
# master branch on push, auto run
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-hexo:
|
build-hexo:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# check it to your workflow can access it
|
# check it to your workflow can access it
|
||||||
# from: https://github.com/actions/checkout
|
# from: https://github.com/actions/checkout
|
||||||
- name: Checkout Repository master branch
|
- name: Checkout Repository master branch
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@master
|
||||||
|
|
||||||
# from: https://github.com/actions/setup-node
|
# from: https://github.com/actions/setup-node
|
||||||
- name: Setup Node.js 10.x
|
- name: Setup Node.js 10.x
|
||||||
uses: actions/setup-node@master
|
uses: actions/setup-node@master
|
||||||
with:
|
with:
|
||||||
node-version: "10.x"
|
node-version: "10.x"
|
||||||
|
|
||||||
- name: Setup Hexo Dependencies
|
- name: Setup Hexo Dependencies
|
||||||
run: |
|
run: |
|
||||||
npm install hexo-cli -g
|
npm install hexo-cli -g
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
- name: Setup Deploy Private Key
|
- name: Setup Deploy Private Key
|
||||||
env:
|
env:
|
||||||
HEXO_DEPLOY_PRIVATE_KEY: ${{ secrets.HEXO_DEPLOY_PRIVATE_KEY }}
|
HEXO_DEPLOY_PRIVATE_KEY: ${{ secrets.HEXO_DEPLOY_PRIVATE_KEY }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh/
|
mkdir -p ~/.ssh/
|
||||||
echo "$HEXO_DEPLOY_PRIVATE_KEY" > ~/.ssh/id_rsa
|
echo "$HEXO_DEPLOY_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||||
chmod 600 ~/.ssh/id_rsa
|
chmod 600 ~/.ssh/id_rsa
|
||||||
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
- name: Setup Git Infomation
|
- name: Setup Git Infomation
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name 'Leon Xu'
|
git config --global user.name 'Leon Xu'
|
||||||
git config --global user.email 'dcwinfield362@gmail.com'
|
git config --global user.email 'dcwinfield362@gmail.com'
|
||||||
- name: Deploy Hexo
|
- name: Deploy Hexo
|
||||||
run: |
|
run: |
|
||||||
hexo clean
|
hexo clean
|
||||||
hexo generate
|
hexo generate
|
||||||
hexo deploy
|
hexo deploy
|
||||||
- name: Upload result from build job
|
- name: Upload result from build job
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: public
|
name: public
|
||||||
path: /public
|
path: /public
|
||||||
deploy-to-website:
|
deploy-to-website:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# check it to your workflow can access it
|
# check it to your workflow can access it
|
||||||
# from: https://github.com/actions/checkout
|
# from: https://github.com/actions/checkout
|
||||||
- name: Get latest code
|
- name: Get latest code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# from: https://github.com/actions/setup-node
|
# from: https://github.com/actions/setup-node
|
||||||
- name: Sync files
|
- name: Sync files
|
||||||
uses: SamKirkland/FTP-Deploy-Action@4.1.0
|
uses: SamKirkland/FTP-Deploy-Action@4.1.0
|
||||||
with:
|
with:
|
||||||
@@ -251,18 +251,18 @@ jobs:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Testing our builds before pushing content to the `master` branch
|
### Testing our builds before pushing content to the `master` branch
|
||||||
What if we want to test our builds in another branch before afecting `master`?
|
What if we want to test our builds in another branch before afecting `master`?
|
||||||
We'll just need to set a `test` job to do this for us:
|
We'll just need to set a `test` job to do this for us:
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
image: node:latest
|
image: node:latest
|
||||||
cache:
|
cache:
|
||||||
paths:
|
paths:
|
||||||
- node_modules/
|
- node_modules/
|
||||||
before_script:
|
before_script:
|
||||||
- npm install -g hexo-cli
|
- npm install -g hexo-cli
|
||||||
- npm install
|
- npm install
|
||||||
# add a job called 'test'
|
# add a job called 'test'
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
@@ -277,7 +277,7 @@ pages:
|
|||||||
- hexo generate
|
- hexo generate
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
only:
|
only:
|
||||||
- master # this job will affect only the 'master' branch
|
- master # this job will affect only the 'master' branch
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in new issue
Block a user