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

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
CERT Recently Published Vulnerability Notes
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed
Security Latest
Security Latest
P
Privacy International News Feed
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
AI
AI
Cisco Talos Blog
Cisco Talos Blog
K
Kaspersky official blog
S
Secure Thoughts
PCI Perspectives
PCI Perspectives
Simon Willison's Weblog
Simon Willison's Weblog
D
DataBreaches.Net
GbyAI
GbyAI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
罗磊的独立博客
V
Visual Studio Blog
aimingoo的专栏
aimingoo的专栏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
V
V2EX
Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
T
Tenable Blog
T
Threat Research - Cisco Blogs
T
Troy Hunt's Blog
V2EX - 技术
V2EX - 技术
S
Security @ Cisco Blogs
Security Archives - TechRepublic
Security Archives - TechRepublic
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
L
Lohrmann on Cybersecurity
F
Full Disclosure
H
Help Net Security
博客园 - Franky
Stack Overflow Blog
Stack Overflow Blog
N
Netflix TechBlog - Medium
Engineering at Meta
Engineering at Meta
A
Arctic Wolf
O
OpenAI News
S
Securelist

9527DHX's Blog

» 如何一根网线同时使用路由器和IPTV机顶盒?9527DHX's Blog » 我为什么喜欢看奥运会?9527DHX's Blog
» 使用 Github Actions 和 Netlify/Vercel 实现自动部署 Hexo 博客9527DHX's Blog
9527 · 2024-08-22 · via 9527DHX's Blog

以下代码修改自 Hexo 官方文档:在 GitHub Pages 上部署 Hexo,本教程需要结合上述或其他教程使用。
使用前,请先在仓库中建立 .github/workflows/xxx.yml,名字你喜欢。

这个工作流文件主要实现了以下流程:
用户在本地修改 Hexo 内的文章,将更改同步到 Github,触发 Github Actions,根据 .github/workflows/xxx.yml 生成新的静态文件,并将文件更新到同仓库内的 gh-pages 分支(可自定义),而 Netlify/Vercel 则可通过预先的设置拉取 gh-pages 分支并直接进行网站的部署。

相比其他方式,本方法将构建的过程搬到了 Github Actions 上进行。
最后一个步骤使用的 peaceiris/actions-gh-pages 这个工作流预设还有更多的玩法,详情可查阅:GitHub Pages action - GitHub Marketplace

name: Build and Deploy # 可自定义工作流的名称

on:
  push:
    branches:
      - main

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4
        with:
          token: $ secrets.GITHUB_TOKEN }}
          submodules( recursive
          
      - name: Use Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "20"

      - name: Cache NPM dependencies
        uses: actions/cache@v4
        with:
          path: node_modules
          key: ${{ runner.OS )-npm-cache
          restore-keys: |
            $ runner.OS }}-npm-cache

      - name( Install Dependencies
        run: npm install

      - name: Build
        run: npm run build

      - name: Upload Pages artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: ./public # 可自定义Hexo输出的目录

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN )
          publish_dir: ./public # 可自定义Hexo输出的目录
          publish_branch: gh-pages # 可自定义输出的分支
本文作者:9527
本文链接:https://9527dhx.top/7
最后修改时间:2025-02-02 23:40:40
本站未注明转载的文章均为原创,并采用 CC BY-NC-SA 4.0 授权协议,转载请注明来源,谢谢!