-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (56 loc) ยท 1.72 KB
/
pages-deploy.yml
File metadata and controls
62 lines (56 loc) ยท 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Build and Deploy
on:
push:
branches:
- master
schedule:
- cron: "0 21 * * *" # UTC 21:00 (ๅไบฌๆถ้ด 05:00)
jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node: ["lts/fermium"]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: "master"
persist-credentials: false
fetch-depth: 0
env:
TZ: Asia/Shanghai
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "12.18.3"
- name: Get Config
id: config
uses: actions/github-script@v6
with:
script: |
const config = require('./blog.config.cjs')
core.setOutput('userName', config.userName)
core.setOutput('userEmail', config.userEmail)
core.setOutput('baseUrl', config.baseUrl)
core.setOutput('repository', config.repository)
- name: Install Dependencies
run: npm install
- name: Build Nuxt Pages
run: npm run generate
- name: Deploy to Pages
env:
TZ: Asia/Shanghai
USER_NAME: ${{ steps.config.outputs.userName }}
USER_EMAIL: ${{ steps.config.outputs.userEmail }}
BASE_URL: ${{ steps.config.outputs.baseUrl }}
REPO: ${{ steps.config.outputs.repository }}
run: |
cd dist
git init
git config user.name "$USER_NAME"
git config user.email "$USER_EMAIL"
git add .
git commit -m 'Deploying to gh-pages from Github actions'
git push -f https://ACCESS_TOKEN:${{secrets.ACCESS_TOKEN }}@github.com/$USER_NAME/$REPO.git master:gh-pages
cd -