-
Notifications
You must be signed in to change notification settings - Fork 27
123 lines (108 loc) · 3.98 KB
/
Deploy Elog-Hexo Public To Pages.yml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Deploy Elog-Hexo Public To Pages
on:
repository_dispatch:
workflow_dispatch:
push:
branches: master
jobs:
deploy:
name: Deploy Elog-Hexo Public To Pages
runs-on: ubuntu-latest
env:
TZ: Asia/Shanghai
YUQUE_TOKEN: ${{ secrets.YUQUE_TOKEN }}
YUQUE_LOGIN: ${{ secrets.YUQUE_LOGIN }}
YUQUE_REPO: ${{ secrets.YUQUE_REPO }}
YUQUE_USERNAME: ${{ secrets.YUQUE_USERNAME }}
YUQUE_PWD: ${{ secrets.YUQUE_PWD }}
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }}
FLOWUS_TABLE_PAGE_ID: ${{ secrets.FLOWUS_TABLE_PAGE_ID }}
webpushrKey: ${{ secrets.WEBPUSHR_KEY }}
webpushrAuthToken: ${{ secrets.WEBPUSHR_AUTH_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@main
with:
ref: master
fetch-depth: 0
submodules: false
- name: Setup Node
uses: actions/setup-node@main
id: setup-node
with:
node-version: "latest"
check-latest: true
cache: "npm"
- name: Catch Dependencies
uses: actions/cache@main
id: cache-dependencies
with:
path: node_modules
key: ${{runner.OS}}-${{hashFiles('**/package-lock.json')}}
- name: Install Dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
npm i
- name: Download Elog Posts
uses: dawidd6/action-download-artifact@v7
with:
github_token: ${{secrets.GITHUB_TOKEN}}
branch: master
name: 'Elog Posts'
path: 'source/_posts'
if_no_artifact_found: warn
- name: Download Elog Cache
uses: dawidd6/action-download-artifact@v7
with:
github_token: ${{secrets.GITHUB_TOKEN}}
branch: master
name: 'Elog Cache'
path: 'elog'
if_no_artifact_found: warn
- name: Generate
run: |
npm run elog
- name: Upload Elog Cache
uses: actions/upload-artifact@v4
with:
name: 'Elog Cache'
path: elog
retention-days: 90
- name: Upload Elog Posts
uses: actions/upload-artifact@v4
with:
name: 'Elog Posts'
path: 'source/_posts'
retention-days: 90
- name: Deploy Markdown Posts To Branch Posts
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: posts
folder: ./source/_posts/
force: false
git-config-name: "github-actions[bot]"
git-config-email: "github-actions[bot]@users.noreply.github.com"
commit-message: ${{ github.event.head_commit.message }}
- name: Deploy Hexo Public To Pages
run: |
cd ./public
git config --global init.defaultBranch master
git config --global http.postBuffer 524288000
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git init
git add -A
git branch -m master
git commit -m "${{ github.event.head_commit.message }} $(date +"%Z %Y-%m-%d %A %H:%M:%S") Updated By GitHub Actions"
git push --force --quiet "https://ccknbc:${{ secrets.GH_TOKEN }}@github.com/CCKNBC/ccknbc.github.io.git" master:master
git push --force --quiet "https://ccknbc:${{ secrets.BB_TOKEN }}@bitbucket.org/ccknbc/ccknbc.bitbucket.io.git" master:master
git push --force --quiet "https://${{ secrets.CD_USER }}:${{ secrets.CD_TOKEN }}@e.coding.net/ccknbc/blog/butterfly.git" master:master
- name: Update GitLab Pages
run: |
curl -X POST --fail -F token=${{ secrets.GITLAB_TRIGGER_TOKEN }} -F ref=master https://gitlab.com/api/v4/projects/20691160/trigger/pipeline
- name: Delete Workflow Runs
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 90
keep_minimum_runs: 6