惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
Google Developers Blog
J
Java Code Geeks
爱范儿
爱范儿
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
人人都是产品经理
人人都是产品经理
Martin Fowler
Martin Fowler
IT之家
IT之家
博客园_首页
B
Blog RSS Feed
Google DeepMind News
Google DeepMind News
B
Blog
U
Unit 42
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
罗磊的独立博客
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog
博客园 - 聂微东
腾讯CDC
A
About on SuperTechFans

辣椒の酱

辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱 辣椒の酱
辣椒の酱
removeif · 2024-12-22 · via 辣椒の酱

写好文件,提交到GitHub
将会自动部署Hexo 博客

仓库目录中增加以下文件: .github\workflows\autodeploy.yml
内容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

name: 自动部署

on:
push:
branches:
- main

release:
types:
- published

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: 检查分支
uses: actions/checkout@v2
with:
ref: main

- name: 安装 Node
uses: actions/setup-node@v1
with:
node-version: "14.x"

- name: 安装 Hexo
run: |
export TZ='Asia/Shanghai'
npm install hexo-cli -g

- name: 缓存 Hexo
uses: actions/cache@v1
id: cache
with:
path: node_modules
key: ${{runner.OS}}-${{hashFiles('**/package-lock.json')}}

- name: 安装依赖
run: |
npm -v
npm install --save
echo "'use strict';const pagination=require('hexo-pagination');module.exports=function(locals){var config=this.config;var posts=locals.posts;posts.data=posts.data.sort(function(a,b){if(a.top==undefined){a.top=0;}if(b.top==undefined){b.top=0;}if(a.top==b.top){return b.date-a.date;}else{return b.top-a.top;}});var paginationDir=config.pagination_dir||'page';return pagination('',posts,{perPage:config.index_generator.per_page,layout:['index','archive'],format:paginationDir+'/%d/',data:{__index:true}});};" > ./node_modules/hexo-generator-index/lib/generator.js

- name: 生成静态文件
run: |
hexo clean
hexo generate

- name: 部署
run: |
cd ./public
git init
git config --global user.name '${{ secrets.GITHUBUSERNAME }}'
git config --global user.email '${{ secrets.GITHUBEMAIL }}'
git add .
git commit -m "${{ github.event.head_commit.message }} $(date +"%Z %Y-%m-%d %A %H:%M:%S") Updated By Github Actions"
git push --force --quiet "https://${{ secrets.GITHUBUSERNAME }}:${{ secrets.GITHUBTOKEN }}@github.com/${{ secrets.GITHUBUSERNAME }}/${{ secrets.GITHUBREPO }}.git" master:main

代码中有相应的变量$,需要自行添加到仓库的配置中。