Skip to content

Commit

Permalink
feat(page): new from github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
idawnlight committed Sep 12, 2023
1 parent 09ff651 commit 20cb815
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 17 deletions.
52 changes: 35 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
branches:
- src

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -13,25 +18,38 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true # Checkout private submodules(themes or something else).

# Caching dependencies to speed up workflows. (GitHub will remove any cache entries that have not been accessed in over 7 days.)
- name: Cache node modules
uses: actions/cache@v3
id: cache
submodules: true # Checkout private submodules (themes or something else).
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Cache NPM dependencies
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.OS }}-npm-cache
restore-keys: |
${{ runner.os }}-node-
${{ runner.OS }}-npm-cache
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci

- name: Hexo Action
uses: sma11black/[email protected]
run: npm install
- name: Build Hexo
run: npm run build
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v2
with:
# The deploy key for Github Pages repo
deploy_key: ${{ secrets.DEPLOY_KEY }}
commit_msg: ${{ github.event.head_commit.message }}
path: public/

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
"hexo": {
"version": "6.3.0"
},
"scripts": {
"build": "hexo generate",
"clean": "hexo clean",
"deploy": "hexo deploy",
"server": "hexo server"
},
"dependencies": {
"hexo": "^6.3.0",
"hexo-deployer-git": "^3.0.0",
Expand Down

0 comments on commit 20cb815

Please sign in to comment.