-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (158 loc) · 7.2 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
env:
PRODUCTION: true
name: Deploy
run-name: ${{ github.actor }} deploys 🚀
on:
push:
branches:
- main
jobs:
build-interactive-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: webdoky/interactive-examples
ref: master
- uses: actions/setup-node@v4
with:
node-version: "18"
- run: yarn install
- run: yarn build
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: interactive-examples
path: ./docs/
build-revamp:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: Install dependencies
run: "go get ..."
- name: Build index generator
run: cd revamp/generators/src/index && go build -o ../../../../exe/
- name: Build summary generator
run: cd revamp/generators/src/summary && go build -o ../../../../exe/
- name: Build format-links preprocessor
run: cd revamp/preprocessors/src/format-links && go build -o ../../../../exe/
- name: Build inject-authors preprocessor
run: cd revamp/preprocessors/src/inject-authors && go build -o ../../../../exe/
- name: Build rewire-paths preprocessor
run: cd revamp/preprocessors/src/rewire-paths && go build -o ../../../../exe/
- name: Build run-macros preprocessor
run: cd revamp/preprocessors/src/run-macros && go build -o ../../../../exe/
- name: Build strip-frontmatter preprocessor
run: cd revamp/preprocessors/src/strip-frontmatter && go build -o ../../../../exe/
- name: Build writer preprocessor
run: cd revamp/preprocessors/src/writer && go build -o ../../../../exe/
- name: Build fix-interactive-examples postprocessor
run: cd revamp/postprocessors/src/fix-interactive-examples && go build -o ../../../../exe/
- name: Build revamp-html postprocessor
run: cd revamp/postprocessors/src/revamp-html && go build -o ../../../../exe/
- name: Build move-media postprocessor
run: cd revamp/postprocessors/src/move-media && go build -o ../../../../exe/
- name: Build populate-algolia postprocessor
run: cd revamp/postprocessors/src/populate-algolia && go build -o ../../../../exe/
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: revamp
path: ./exe/
build:
needs: [build-interactive-examples, build-revamp]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
submodules: true
- name: Setup MDBook
run: mkdir bin && curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.35/mdbook-v0.4.35-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=bin
- uses: actions/download-artifact@v3
with:
name: revamp
path: revamp/exe
- run: ls ./revamp/exe
- run: chmod +x ./revamp/exe/index && ./revamp/exe/index
- run: chmod +x ./revamp/exe/summary && ./revamp/exe/summary
- run: chmod +x ./revamp/exe/format-links
- run: chmod +x ./revamp/exe/inject-authors
- run: chmod +x ./revamp/exe/rewire-paths
- run: chmod +x ./revamp/exe/run-macros
- run: chmod +x ./revamp/exe/strip-frontmatter
- run: chmod +x ./revamp/exe/writer
- run: ./bin/mdbook build
- run: ls ./book
- run: ls .
- run: cp -r ./live-samples ./book/live-samples
- run: cp -r ./static ./book/static
- run: cp ./src/robots.txt ./book/robots.txt
- uses: actions/download-artifact@v3
with:
name: interactive-examples
path: book/interactive-examples
- run: chmod +x ./revamp/exe/fix-interactive-examples && ./revamp/exe/fix-interactive-examples
- run: chmod +x ./revamp/exe/revamp-html && ./revamp/exe/revamp-html
- run: chmod +x ./revamp/exe/move-media && ./revamp/exe/move-media
- run: sudo apt install rename
# Recursively replace all asterisks in folder names with "_asterisk_"
- run: find ./book -depth -type d -name "*" -execdir rename 's/\*/_asterisk_/g' "{}" \;
# Recursively replace all doublecolons in folder names with "_doublecolon_"
- run: find ./book -depth -type d -name "*" -execdir rename 's/::/_doublecolon_/g' "{}" \;
# Recursively replace all colons in folder names with "_colon_"
- run: find ./book -depth -type d -name "*" -execdir rename 's/:/_colon_/g' "{}" \;
- uses: actions/upload-artifact@v3
with:
if-no-files-found: error
name: build
path: book
populate-algolia:
needs: [build, build-revamp]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
submodules: true
- uses: actions/download-artifact@v3
with:
name: revamp
path: revamp/exe
- uses: actions/download-artifact@v3
with:
name: build
path: book
- run: chmod +x ./revamp/exe/populate-algolia
- run: ./revamp/exe/populate-algolia
env:
ALGOLIA_APP_ID: ${{ env.ALGOLIA_APP_ID }}
ALGOLIA_ADMIN_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: build
path: book
- run: sudo apt install rename
# Recursively replace all "_asterisk_" in folder names with asterisks
- run: find ./book -depth -type d -name "*_asterisk_*" -execdir rename 's/_asterisk_/*/g' "{}" \;
# Recursively replace all "_doublecolon_" in folder names with doublecolons
- run: find ./book -depth -type d -name "*_doublecolon_*" -execdir rename 's/_doublecolon_/::/g' "{}" \;
# Recursively replace all "_colon_" in folder names with colons
- run: find ./book -depth -type d -name "*_colon_*" -execdir rename 's/_colon_/:/g' "{}" \;
- uses: actions/setup-node@v4
with:
node-version: "18"
- run: yarn global add surge
- run: surge --project ./book --domain webdoky3.surge.sh
env:
SURGE_LOGIN: ${{ env.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}