-
Notifications
You must be signed in to change notification settings - Fork 181
131 lines (113 loc) · 4.4 KB
/
deploy.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
124
125
126
127
128
129
130
131
# This is a basic workflow to help you get started with Actions
name: Test and Deploy Website
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [master]
schedule:
# Run everyday at 9:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
- cron: '0 5 * * *'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3.1.0
with:
submodules: recursive
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Get node version
id: node-version
run: |
echo "::set-output name=ver::$(node --version)"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
# use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: Cache install
uses: actions/cache@v3
with:
path: |
./node_modules
./doc/node_modules
./website/node_modules
./blog/node_modules
key: ${{ runner.os }}-dep-${{ steps.node-version.outputs.ver }}-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: |
yarn install
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%V")"
shell: bash
- name: Apply docs cache
id: docs-cache
uses: actions/cache@v3
with:
path: |
./scripts/temp
key: ${{ runner.os }}-${{ steps.node-version.outputs.ver }}-docs-${{ hashFiles('website/config/apisix-versions.js') }}-${{ steps.get-date.outputs.date }}
restore-keys: |
${{ runner.os }}-${{ steps.node-version.outputs.ver }}-docs-${{ hashFiles('website/config/apisix-versions.js') }}
- name: Sync documents
run: |
yarn prepare-data && git status
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Apply docusaurus cache
id: docusaurus-cache
uses: actions/cache@v3
with:
path: |
./website/.docusaurus
./website/build
./doc/.docusaurus
./doc/build
./blog/en/.docusaurus
./blog/en/build
./blog/zh/.docusaurus
./blog/zh/build
key: ${{ runner.os }}-dep-${{ steps.node-version.outputs.ver }}-docusaurus-${{ hashFiles('website/config/apisix-versions.js') }}-${{ steps.get-date.outputs.date }}
restore-keys: |
${{ runner.os }}-dep-${{ steps.node-version.outputs.ver }}-docs-${{ hashFiles('website/config/apisix-versions.js') }}
- name: Build
run: |
yarn build
- name: Update sitemap.xml
run: |
yarn update-sitemap && git status
- name: Deploy to Netlify
uses: ./.github/actions/actions-netlify
if: ${{ false }}
with:
publish-dir: './website/build'
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: '${{ github.event.pull_request.title }}, Deploy from GitHub Actions'
enable-pull-request-comment: true
enable-commit-comment: true
overwrites-pull-request-comment: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 10
- name: Deploy
uses: peaceiris/actions-gh-pages@v3.9.0
if: github.event_name == 'push' && github.ref == 'refs/heads/master' || github.event_name == 'schedule'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: website/build
publish_branch: asf-site
force_orphan: true