Skip to content

Commit

Permalink
by 七点一刻
Browse files Browse the repository at this point in the history
  • Loading branch information
LeungGeorge committed Jul 19, 2024
1 parent 5464455 commit fa893fb
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Pages

# 触发器、分支
on:
push:
branches:
- hexo # default branch
jobs:
# 子任务
pages:
runs-on: ubuntu-latest # 定运行所需要的虚拟机环境
permissions:
contents: write
steps:
- uses: actions/checkout@v2
# with:
# submodules: true
# fetch-depth: 0
# 每个name表示一个步骤:step
- name: Use Node.js 19.x
uses: actions/setup-node@v2
with:
node-version: '19.3.0' # 自己正在使用的node版本即可
# - run: node -v # 查看node版本号
# 缓存依赖项: https://docs.github.com/cn/actions/using-workflows/caching-dependencies-to-speed-up-workflows
- name: Cache NPM dependencies
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
# path: node_modules
key: ${{ runner.OS }}-npm-cache
restore-keys: |
${{ runner.OS }}-npm-cache
# 查看路径 : /home/runner/work/blog/blog
# - name: Look Path
# run: pwd
# 查看文件
- name: Look Dir List
run: tree -L 3 -a
# 第一次或者依赖发生变化的时候执行 Install Dependencies,其它构建的时候不需要这一步
- name: Install Dependencies
run: npm install
- name: Look Dir List
run: tree -L 3 -a
# - name: clean theme cache
# run: git rm -f --cached themes/tenacity
# run: git submodule deinit themes/tenacity && git rm themes/tenacity
# 安装主题
#- name: Install Theme
# run: git submodule add https://github.com/iissnan/hexo-theme-next.git themes/next
- name: Clean
run: npm run clean
- name: Build
run: npm run build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
user_name: LeungGeorge
user_email: [email protected]
# 获取提交文章源码时的commit message,作为发布gh-pages分支的信息
commit_message: ${{ github.event.head_commit.message }}
full_commit_message: ${{ github.event.head_commit.message }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# GITHUB_TOKEN不是个人访问令牌,GitHub Actions 运行器会自动创建一个GITHUB_TOKEN密钥以在您的工作流程中进行身份验证。因此,您无需任何配置即可立即开始部​​署
publish_dir: ./public
allow_empty_commit: true # 允许空提交
# Use the output from the `deploy` step(use for test action)
- name: Get the output
run: |
echo "${{ steps.deploy.outputs.notify }}"

0 comments on commit fa893fb

Please sign in to comment.