Skip to content

Commit

Permalink
配置github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kaierwen committed Aug 15, 2024
1 parent 3b3ece3 commit eaa7adb
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Pages

on:
push:
branches:
- main # default branch

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
# If your repository depends on submodule, please see: https://github.com/actions/checkout
submodules: recursive
- name: Use Node.js 21.7.2
uses: actions/setup-node@v4
with:
# Examples: 20, 18.19, >=16.20.2, lts/Iron, lts/Hydrogen, *, latest, current, node
# Ref: https://github.com/actions/setup-node#supported-version-syntax
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
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
6 changes: 2 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ timezone: "Asia/Shanghai"

# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: http://example.com
url: https://kaierwen.github.io/blog
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
Expand Down Expand Up @@ -104,6 +104,4 @@ theme: landscape
# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
type: git
repo: https://github.com/kaierwen/blog
branch: gh-pages
type:

0 comments on commit eaa7adb

Please sign in to comment.