1- # This is a basic workflow to help you get started with Actions
1+ name : Pages
22
3- name : Deploy
4-
5- # Controls when the action will run. Triggers the workflow on push or pull request
6- # events but only for the master branch
73on :
84 push :
9- branches : [ master ]
5+ branches :
6+ - main # default branch
107
118jobs :
129 build :
1310 runs-on : ubuntu-latest
14- name : A job to deploy blog.
1511 steps :
16- - name : Checkout
17- uses : actions/checkout@v1
18- with :
19- submodules : true # Checkout private submodules(themes or something else).
20-
21- # Caching dependencies to speed up workflows. (GitHub will remove any cache entries that have not been accessed in over 7 days.)
22- - name : Cache node modules
23- uses : actions/cache@v1
24- id : cache
25- with :
26- path : node_modules
27- key : ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
28- restore-keys : |
29- ${{ runner.os }}-node-
30- - name : Install Dependencies
31- if : steps.cache.outputs.cache-hit != 'true'
32- run : npm install
33-
34- # Deploy hexo blog website.
35- - name : Deploy
36- id : deploy
37- uses : sma11black/hexo-action@v1.0.4
38- with :
39- deploy_key : ${{ secrets.DEPLOY_KEY }}
40- user_name : IchenDEV # (or delete this input setting to use bot account)
41- user_email : idevlab@outlook.com # (or delete this input setting to use bot account)
42- commit_msg : ${{ github.event.head_commit.message }} # (or delete this input setting to use hexo default settings)
43- # Use the output from the `deploy` step(use for test action)
44- - name : Get the output
45- run : |
46- echo "${{ steps.deploy.outputs.notify }}"
12+ - uses : actions/checkout@v4
13+ with :
14+ token : ${{ secrets.GITHUB_TOKEN }}
15+ # If your repository depends on submodule, please see: https://github.com/actions/checkout
16+ submodules : recursive
17+ - name : Use Node.js 22
18+ uses : actions/setup-node@v4
19+ with :
20+ # Examples: 20, 18.19, >=16.20.2, lts/Iron, lts/Hydrogen, *, latest, current, node
21+ # Ref: https://github.com/actions/setup-node#supported-version-syntax
22+ node-version : " 22"
23+ - name : Cache NPM dependencies
24+ uses : actions/cache@v4
25+ with :
26+ path : node_modules
27+ key : ${{ runner.OS }}-npm-cache
28+ restore-keys : |
29+ ${{ runner.OS }}-npm-cache
30+ - name : Install Dependencies
31+ run : npm install
32+ - name : Build
33+ run : npm run build
34+ - name : Upload Pages artifact
35+ uses : actions/upload-pages-artifact@v3
36+ with :
37+ path : ./public
38+ deploy :
39+ needs : build
40+ permissions :
41+ pages : write
42+ id-token : write
43+ environment :
44+ name : github-pages
45+ url : ${{ steps.deployment.outputs.page_url }}
46+ runs-on : ubuntu-latest
47+ steps :
48+ - name : Deploy to GitHub Pages
49+ id : deployment
50+ uses : actions/deploy-pages@v4
0 commit comments