Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- name: Build Blog
- on:
- # Run GH Actions if push to `master` branch
- push:
- branches:
- - master # ps. change to `main` if ur default branch follow's GitHub
- jobs:
- deploy-blog:
- # Use macOS Monterey 12
- runs-on: macos-12 # ps. change to `ubuntu-latest` if coz any problem(s)
- steps:
- # Get blog's src
- - name: Get blog source file
- uses: actions/checkout@v3
- # Use Node.js Version 16.x
- - name: Use Node.js 16
- uses: actions/setup-node@v3
- with:
- node-version: 16 # ps. change to `14` if coz any problem(s)
- # Install deps via Yarn
- - name: Install deps
- run: |
- npm install yarn -g
- yarn global add hexo-cli
- yarn install --frozen-lockfile
- # Config system env (SSH, Git, etc.)
- - name: Config env
- env:
- DEPLOY_SEC_KEY: ${{ secrets.DEPLOY_SEC_KEY }} # ps. change to your own value
- run: |
- mkdir -p ~/.ssh/
- echo "$DEPLOY_SEC_KEY" > ~/.ssh/id_rsa
- chmod 777 ~/.ssh/id_rsa
- ssh-keyscan github.com >> ~/.ssh/known_hosts
- git config --global user.name "Hexo Deployment"
- git config --global user.email "khhdeployhexo@fakeaddress.nekohuan.cyou"
- # chmod 777 may coz security problems
- # Deploy using hexo-cli
- - name: Deploy
- run: |
- hexo clean
- hexo d --generate
- # Output to dir `public`
- - name: Output to folder
- uses: peaceiris/actions-gh-pages@v3
- with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- publish_dir: ./public
- publish_branch: static
- # GitHub Actions config for deployin' Hexo blog, authored by KuoHuanHuan.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement