Skip to content

Commit 981da9a

Browse files
authored
Merge pull request #350 from EvanNotFound/dev
ci
2 parents b36bad4 + 3f1c5b5 commit 981da9a

File tree

7 files changed

+160
-25
lines changed

7 files changed

+160
-25
lines changed

.github/workflows/preview.yml

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: GitHub Actions Vercel Preview Deployment
1+
name: Vercel Preview Deployment
22
env:
33
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
44
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
@@ -7,24 +7,38 @@ on:
77
push:
88
branches:
99
- dev
10+
pull_request: # Trigger the workflow on pull request activities
11+
branches:
12+
- main # Specify the target branch for PRs
1013

1114
jobs:
1215
Deploy-Preview:
1316
runs-on: ubuntu-latest
1417

1518
steps:
19+
- id: script
20+
uses: actions/github-script@v3
21+
with:
22+
script: |
23+
const isPr = [ 'pull_request', 'pull_request_target' ].includes(context.eventName)
24+
core.setOutput('ref', isPr ? context.payload.pull_request.head.ref : context.ref)
25+
core.setOutput('repo', isPr ? context.payload.pull_request.head.repo.full_name : context.repo.full_name)
26+
27+
1628
- name: Checkout theme repository
1729
uses: actions/checkout@v2
1830
with:
1931
path: 'theme' # Checkout the theme repository into a directory named 'theme'
32+
ref: ${{ steps.script.outputs.ref }}
33+
repository: ${{ steps.script.outputs.repo }}
2034

2135
- name: Setup Node.js
2236
uses: actions/setup-node@v2
2337
with:
24-
node-version: '18' # Specify your required Node.js version
38+
node-version: '20.x' # Specify your required Node.js version
2539

2640
- name: Clone Hexo site repository
27-
run: git clone https://github.com/Evanovation/redefine-dev-preview.git hexo-site
41+
run: git clone https://github.com/EvanNotFound/redefine-demo.git hexo-site
2842

2943
- name: Move theme into Hexo site
3044
run: |
@@ -33,25 +47,55 @@ jobs:
3347
- name: Install dependencies
3448
run: |
3549
cd hexo-site
36-
# npm install
50+
npm install
51+
52+
- name: Build Hexo
53+
run: |
54+
cd hexo-site
55+
npm install
56+
npm uninstall hexo-theme-redefine
57+
npm run build
3758
38-
# - name: Generate static pages
39-
# run: |
40-
# cd hexo-site
41-
# npm run build
4259
4360
- name: Install Vercel CLI
4461
run: npm install --global vercel@canary
45-
46-
- name: Pull Vercel Environment Information
47-
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
48-
49-
- name: Build Project Artifacts
50-
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
51-
52-
- name: Deploy Project Artifacts to Vercel
53-
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
5462

63+
- name: Change directory to hexo-site
64+
run: echo "HEXO_SITE_DIR=${{ github.workspace }}/hexo-site" >> $GITHUB_ENV
65+
66+
# - uses: amondnet/vercel-action@v20 #deploy
67+
# with:
68+
# vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
69+
# vercel-org-id: ${{ secrets.VERCEL_ORG_ID}} #Required
70+
# github-token: ${{ secrets.GITHUB_TOKEN }} #Optional
71+
# vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}} #Required
72+
# working-directory: ${{ env.HEXO_SITE_DIR }}
73+
74+
- name: Deploy to Vercel Action
75+
uses: EvanNotFound/vercel-deployment-for-github-actions@v1
76+
with:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
79+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
80+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
81+
WORKING_DIRECTORY: ${{ env.HEXO_SITE_DIR }}
82+
VERCEL_SCOPE: ${{ secrets.VERCEL_SCOPE }}
83+
PRODUCTION: false
84+
DEPLOY_PR_FROM_FORK: true
85+
ALIAS_DOMAINS: |
86+
redefine-preview.vercel.app
87+
redefine-preview-git-{SHA}.vercel.app
88+
PR_PREVIEW_DOMAIN: "redefine-preview-pr-{PR}.vercel.app"
5589

5690

91+
# - name: Pull Vercel Environment Information
92+
# run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
93+
# working-directory: ${{ env.HEXO_SITE_DIR }}
94+
95+
# - name: Build Project Artifacts
96+
# run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
97+
# working-directory: ${{ env.HEXO_SITE_DIR }}
5798

99+
# - name: Deploy Project Artifacts to Vercel
100+
# run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
101+
# working-directory: ${{ env.HEXO_SITE_DIR }}

.github/workflows/production-demo.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Vercel Production Deployment
2+
env:
3+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
4+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
5+
on:
6+
workflow_dispatch:
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
Deploy-Preview:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout theme repository
17+
uses: actions/checkout@v2
18+
with:
19+
path: 'theme' # Checkout the theme repository into a directory named 'theme'
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: '20.x' # Specify your required Node.js version
25+
26+
- name: Clone Hexo site repository
27+
run: git clone https://github.com/EvanNotFound/redefine-demo.git hexo-site
28+
29+
- name: Move theme into Hexo site
30+
run: |
31+
mv theme hexo-site/themes/redefine
32+
33+
- name: Install dependencies
34+
run: |
35+
cd hexo-site
36+
npm install
37+
38+
- name: Build Hexo
39+
run: |
40+
cd hexo-site
41+
npm install
42+
npm uninstall hexo-theme-redefine
43+
npm run build
44+
45+
46+
- name: Install Vercel CLI
47+
run: npm install --global vercel@canary
48+
49+
- name: Change directory to hexo-site
50+
run: echo "HEXO_SITE_DIR=${{ github.workspace }}/hexo-site" >> $GITHUB_ENV
51+
52+
# - uses: amondnet/vercel-action@v20 #deploy
53+
# with:
54+
# vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
55+
# vercel-org-id: ${{ secrets.VERCEL_ORG_ID}} #Required
56+
# github-token: ${{ secrets.GITHUB_TOKEN }} #Optional
57+
# vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}} #Required
58+
# working-directory: ${{ env.HEXO_SITE_DIR }}
59+
60+
- name: Deploy to Vercel Action
61+
uses: EvanNotFound/vercel-deployment-for-github-actions@v1
62+
with:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
65+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
66+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
67+
WORKING_DIRECTORY: ${{ env.HEXO_SITE_DIR }}
68+
VERCEL_SCOPE: ${{ secrets.VERCEL_SCOPE }}
69+
PRODUCTION: true
70+
DEPLOY_PR_FROM_FORK: true
71+
ALIAS_DOMAINS: |
72+
redefine.ohevan.com
73+
PR_PREVIEW_DOMAIN: "redefine-preview-pr-{PR}.vercel.app"
74+
75+
76+
# - name: Pull Vercel Environment Information
77+
# run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
78+
# working-directory: ${{ env.HEXO_SITE_DIR }}
79+
80+
# - name: Build Project Artifacts
81+
# run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
82+
# working-directory: ${{ env.HEXO_SITE_DIR }}
83+
84+
# - name: Deploy Project Artifacts to Vercel
85+
# run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
86+
# working-directory: ${{ env.HEXO_SITE_DIR }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ _DelSyncFiles/
4747

4848
.env
4949
.env.local
50+
.vercel

_config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,12 @@ plugins:
415415
artist: # audio artist
416416
url: # audio url
417417
cover: # audio cover url
418+
lrc: # audio cover lrc
418419
# - name: # audio name
419420
# artist: # audio artist
420421
# url: # audio url
421422
# cover: # audio cover url
423+
# lrc: # audio cover lrc
422424
# .... you can add more audios here
423425
# Mermaid JS. Requires hexo-filter-mermaid-diagrams (npm i hexo-filter-mermaid-diagrams). See https://mermaid.js.org/
424426
mermaid:

source/css/layout/_modules/aplayer.styl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,6 @@ $aplayer-height-lrc= $aplayer-height + $lrc-height - 6
254254
display none
255255
}
256256

257-
.aplayer-icon-lrc {
258-
pointer-events none
259-
svg {
260-
opacity 0.4
261-
}
262-
}
263-
264257
.aplayer-icon-lrc-inactivity {
265258
svg {
266259
opacity 0.4
@@ -803,4 +796,4 @@ if (hexo-config('plugins.aplayer.enable') == true && hexo-config('plugins.aplaye
803796
width: 13px !important
804797
}
805798

806-
}
799+
}

source/js/plugins/aplayer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ if (isMini) {
2424
const ap = new APlayer({
2525
container: document.getElementById("aplayer"),
2626
fixed: true,
27+
lrcType: 3,
2728
audio: audioList,
2829
});
30+
document.querySelector(".aplayer-icon-lrc").click();
2931
}

vercel.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"version": 2,
3+
"public": false,
4+
"github": {
5+
"enabled": false
6+
}
7+
}

0 commit comments

Comments
 (0)