-
Notifications
You must be signed in to change notification settings - Fork 9
170 lines (157 loc) · 5.96 KB
/
mdbook.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
161
162
163
164
165
166
167
168
169
170
name: Deploy mdBook site to Pages and Create Release
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set up nvm, node, npm p0
run: |
echo "$HOME" >> $GITHUB_PATH
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
- name: Set up nvm, node, npm p1
run: |
source $NVM_DIR/nvm.sh
nvm install 20.0.0
nvm --version
- name: Set up cargo
run: |
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
rustup update
cargo install wasm-tools
rustup install nightly
rustup target add wasm32-wasi
rustup target add wasm32-wasi --toolchain nightly
cargo install cargo-wasi
#- name: Get latest release from foundry-rs/foundry
# id: get-latest-foundry-release
# uses: actions/github-script@v6
# with:
# script: |
# const repo = {
# owner: 'foundry-rs',
# repo: 'foundry',
# per_page: 1,
# page: 1,
# };
# const releases = await github.rest.repos.listReleases(repo);
# const preReleases = releases.data.filter(release => release.prerelease);
# // Sort pre-releases by created_at date in descending order
# preReleases.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
# if (preReleases.length === 0) {
# throw new Error('No pre-releases found');
# }
# const latestPreRelease = preReleases[0];
# const asset = latestPreRelease.assets.find(asset => asset.name.match(/foundry_nightly_linux_amd64\.tar\.gz/));
# if (!asset) {
# throw new Error('Asset not found');
# }
# return asset.browser_download_url;
# result-encoding: string
- name: Download the Foundry release
run: wget -q https://github.com/foundry-rs/foundry/releases/download/nightly-de596a4db781933f0c95805bd1c8c05e65f03d4f/foundry_nightly_linux_amd64.tar.gz -O foundry.tar.gz
#run: wget -q ${DOWNLOAD_URL} -O foundry.tar.gz
#env:
# DOWNLOAD_URL: ${{ steps.get-latest-foundry-release.outputs.result }}
- name: Untar the release
run: tar zxf foundry.tar.gz
- name: Add Foundry to path
run: echo "$PWD" >> $GITHUB_PATH
#- name: Get latest release from kinode-dao/kit
# id: get-latest-kit-release
# uses: actions/github-script@v6
# with:
# script: |
# const repo = {
# owner: 'kinode-dao',
# repo: 'kit',
# };
# const release = await github.rest.repos.getLatestRelease(repo);
# const asset = release.data.assets.find(asset => asset.name.match(/kit-x86_64-unknown-linux-gnu\.zip/));
# if (!asset) {
# throw new Error('Asset not found');
# }
# return asset.browser_download_url;
# result-encoding: string
- name: Download the Kit release
run: wget -q https://files.yael.solutions/240906/kit-x86_64-unknown-linux-gnu.zip -O kit.zip
#run: wget -q ${DOWNLOAD_URL} -O kit.zip
#env:
# DOWNLOAD_URL: ${{ steps.get-latest-kit-release.outputs.result }}
- name: Unzip the release
run: unzip kit.zip
- name: Download the Kinode release
run: wget -q https://files.yael.solutions/240906/kinode-x86_64-unknown-linux-gnu-simulation-mode.zip -O kinode.zip
- name: Unzip the Kinode release
run: unzip kinode.zip
- name: Run Kit tests
#run: ./kit t code/tests.toml
run: |
{ ./kit t code/tests.toml; } 2>&1
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install mdBook
run: |
cargo install --git https://github.com/nick1udwig/mdBook --branch hf/dont-write-searchindex-json --locked mdbook
cargo install mdbook-linkcheck
cargo install mdbook-webinclude
cargo install --git https://github.com/nick1udwig/mdbook-hide-feature --locked
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Build with mdBook
run: mdbook build
- name: Upload artifact for deployment
uses: actions/upload-pages-artifact@v3
with:
path: ./book/html
- name: Archive built site
run: tar -czf book.tar.gz -C book/html .
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release ${{ github.run_number }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./book.tar.gz
asset_name: book.tar.gz
asset_content_type: application/gzip
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4