Skip to content

fix: Github Pages部署 #150

fix: Github Pages部署

fix: Github Pages部署 #150

Workflow file for this run

name: Hexo Deploy
on:
push:
branches:
- blog
jobs:
build:
name: NPM Install & Hexo Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Setup NPM & Hexo environment
env:
ACTION_DEPLOY_KEY: ${{ secrets.HEXO_DEPLOY_PRI }}
run: |
mkdir -p ~/.ssh/
echo "$ACTION_DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
git config --global user.email "[email protected]"
git config --global user.name "lyz05"
npm install hexo-cli -g
npm ci
- name: Hexo generate & Deploy To Github Pages
run: |
hexo clean
hexo douban -bm
hexo generate
- name: Setup ossutil
uses: manyuanrong/[email protected]
with:
endpoint: "oss-cn-hongkong.aliyuncs.com"
access-key-id: ${{ secrets.ALIBABA_CLOUD_ACCESS_KEY_ID }}
access-key-secret: ${{ secrets.ALIBABA_CLOUD_ACCESS_KEY_SECRET }}
- name: Deply To OSS
run: |
ossutil cp -r -u -j 24 public oss://lyz05blog/
notification:
name: Notify
runs-on: ubuntu-latest
needs: [build]
if: always()
env:
key: ${{ secrets.sckey }}
failure: 博客部署失败
cancelled: 博客部署被取消
success: 博客部署成功
steps:
- uses: martialonline/workflow-status@v3
id: check
- run: curl -d "title=$failure&content=$failure" "http://www.pushplus.plus/send/$key"
if: steps.check.outputs.status == 'failure'
- run: curl -d "title=$cancelled&content=$cancelled" "http://www.pushplus.plus/send/$key"
if: steps.check.outputs.status == 'cancelled'
- run: curl -d "title=$success&content=$success" "http://www.pushplus.plus/send/$key"
if: steps.check.outputs.status == 'success'