forked from argumentcomputer/zk-light-clients
-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (157 loc) · 4.83 KB
/
book.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
159
160
name: Deploy mdBook to GitHub Pages
on:
# Always build & deploy on push to `dev`
push:
branches:
- dev
pull_request:
branches: [dev]
# Only build if docs are changed
paths:
- "aptos/docs/**"
- "ethereum/docs/**"
- "kadena/docs/**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@mdbook
- name: Build mdbook
run: |
for book in aptos ethereum kadena; do
echo "Creating ${book} mdbook"
mkdir -p public/${book}
cd ${book}/docs
mdbook build
cp -r book/* ${{ github.workspace }}/public/${book}
cd ${{ github.workspace }}
done
working-directory: ${{ github.workspace }}
- name: Create base page
run: |
cat <<EOF > ./public/index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ZK Light Clients</title>
<link rel="stylesheet" href="./aptos/theme/css/light.css">
</head>
<body>
<main class="mdbook">
<h1>ZK Light Clients</h1>
<ul>
<li><a href="./aptos/">Aptos</a></li>
<li><a href="./ethereum/">Ethereum</a></li>
<li><a href="./kadena/">Ethereum</a></li>
</ul>
</main>
</body>
</html>
EOF
working-directory: ${{ github.workspace }}
- name: Upload build artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public
retention-days: 1
deploy:
needs: build
if: github.ref_name == 'dev' && github.event_name == 'push'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
# Detect changes in each subcrate
# changes:
# runs-on: ubuntu-latest
# outputs:
# # List of changed mdbooks
# books: ${{ steps.get-packages.outputs.books }}
# steps:
# - uses: actions/checkout@v4
# - uses: dorny/paths-filter@v3
# id: filter
# with:
# filters: |
# aptos:
# - 'aptos/docs/**'
# ethereum:
# - 'ethereum/docs/**'
# kadena:
# - 'kadena/docs/**'
# - name: Get list of changed packages
# id: get-packages
# run: |
# BOOKS=$(echo '${{ steps.filter.outputs.changes }}' | jq -c '.')
# echo "books=$BOOKS" | tee -a "$GITHUB_OUTPUT"
#
# # TODO: Build all light clients always unless we can only deploy changed and keep old
# build:
# needs: changes
# #if: ${{ needs.changes.outputs.books != '[]' && needs.changes.outputs.books != '' }}
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# # Parse JSON array containing names of all changed light client mdbooks,
# # e.g. ['aptos', 'ethereum', 'kadena'] if the `aptos`, `ethereum` and `kadena` mdbooks contain changes.
# #light-client: ${{ fromJSON(needs.changes.outputs.books) }}
# light-client: ['aptos', 'ethereum', 'kadena']
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@stable
# - uses: taiki-e/install-action@mdbook
# - run: |
# mdbook build
# ls book
# working-directory: ${{ github.workspace }}/${{ matrix.light-client }}/docs
# - name: Upload build artifact
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.light-client }}
# path: ${{ matrix.light-client }}/docs/book
# retention-days: 1
#
# deploy:
# needs: [changes, build]
# if: ${{ github.ref_name == 'dev' && github.event_name == 'push' }}
# runs-on: ubuntu-latest
# permissions:
# contents: write
# steps:
# - uses: actions/checkout@v4
# - name: Create publish dir
# run: |
# mkdir -p public
# ls public
# working-directory: ${{ github.workspace }}
# - name: Download book artifacts
# uses: actions/download-artifact@v4
# with:
# path: ./public
# - run: |
# echo "PUBLIC"
# ls public
# echo "PUBLIC/APTOS"
# ls public/aptos
# echo "PUBLIC/ETHEREUM"
# ls public/ethereum
# echo "PUBLIC/KADENA"
# ls public/kadena
# - name: Deploy mdbook
# uses: peaceiris/actions-gh-pages@v4
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./public
#