Skip to content

Commit f869e5b

Browse files
committed
Export documentation for latest AND past stdlib versions.
1 parent e08c70f commit f869e5b

File tree

1 file changed

+100
-6
lines changed

1 file changed

+100
-6
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 100 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,113 @@ jobs:
4141
- name: 🔬 Run tests
4242
run: aiken check
4343

44+
docs:
45+
strategy:
46+
matrix:
47+
include:
48+
- stdlib_version: v1.9.0
49+
legacy_aiken_setup: true
50+
aiken_version: v1.0.29-alpha
51+
runner: ubuntu-22.04
52+
53+
- stdlib_version: v2.0.0
54+
legacy_aiken_setup: true
55+
aiken_version: v1.1.2
56+
57+
- stdlib_version: v2.1.0
58+
59+
- stdlib_version: v2.2.0
60+
61+
- stdlib_version: ""
62+
63+
runs-on: ${{ matrix.runner || 'ubuntu-latest' }}
64+
65+
steps:
66+
- name: 📥 Checkout repository
67+
uses: actions/checkout@v4
68+
with:
69+
ref: ${{ matrix.stdlib_version }}
70+
71+
- name: 🧰 Setup Pages
72+
uses: actions/configure-pages@v5
73+
74+
- name: 🧰 Install Aiken (legacy)
75+
if: ${{ matrix.legacy_aiken_setup }}
76+
uses: aiken-lang/[email protected]
77+
with:
78+
version: ${{ matrix.aiken_version || 'v1.1.19' }}
79+
80+
- name: 🧰 Install Aiken
81+
if: ${{ !matrix.legacy_aiken_setup }}
82+
uses: aiken-lang/setup-aiken@v1
83+
with:
84+
version: ${{ matrix.aiken_version || 'v1.1.19' }}
85+
4486
- name: 📘 Generate documentation
4587
shell: bash
4688
working-directory: .
47-
run: aiken docs -o docs
89+
run: aiken docs -o docs/${{ matrix.stdlib_version || 'latest' }}
90+
91+
- name: 🏠 Redirection page for v-less sub-directories
92+
if: ${{ matrix.stdlib_version }}
93+
shell: bash
94+
working-directory: docs
95+
run: |
96+
version=$(echo ${{matrix.stdlib_version}} | cut -c2-)
97+
mkdir -p $version
98+
cat > $version/index.html <<HTML
99+
<!DOCTYPE html>
100+
<html>
101+
<head>
102+
<title>Aiken StdLib API reference</title>
103+
<link rel="canonical" href="https://aiken-lang.github.io/stdlib"/>
104+
<meta name="robots" content="noindex">
105+
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
106+
<meta http-equiv="refresh" content="0; url=/stdlib/${{ matrix.stdlib_version }}"/>
107+
</head>
108+
</html>
109+
HTML
110+
111+
- name: 📦 Upload artifact
112+
uses: actions/upload-artifact@v4
113+
with:
114+
name: aiken-docs-${{ matrix.stdlib_version || 'latest' }}
115+
path: docs
116+
retention-days: 1
117+
118+
bundle-docs:
119+
runs-on: ubuntu-latest
120+
needs: [docs]
121+
steps:
122+
- name: 📥 Download all doc artifacts
123+
uses: actions/download-artifact@v5
124+
with:
125+
pattern: aiken-docs-*
126+
merge-multiple: true
127+
128+
- name: 🏠 Landing page
129+
shell: bash
130+
run: |
131+
cat > index.html <<HTML
132+
<!DOCTYPE html>
133+
<html>
134+
<head>
135+
<title>Aiken StdLib API reference</title>
136+
<link rel="canonical" href="https://aiken-lang.github.io/stdlib"/>
137+
<meta name="robots" content="noindex">
138+
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
139+
<meta http-equiv="refresh" content="0; url=/stdlib/latest"/>
140+
</head>
141+
</html>
142+
HTML
48143
49144
- name: 📦 Upload artifact
50-
uses: actions/upload-pages-artifact@v3
145+
uses: actions/upload-pages-artifact@v4
51146
with:
52-
path: "docs/"
147+
path: .
53148

54-
deploy:
55-
if: ${{ startsWith(github.ref, 'refs/tags') }}
56-
needs: build
149+
deploy-docs:
150+
needs: [bundle-docs]
57151
runs-on: ubuntu-latest
58152
environment:
59153
name: github-pages

0 commit comments

Comments
 (0)