Skip to content

Commit 956c1c4

Browse files
refactor(ci): add check for generated artifact
Signed-off-by: Victor Adossi <vadossi@cosmonic.com>
1 parent 0561062 commit 956c1c4

1 file changed

Lines changed: 27 additions & 14 deletions

File tree

.github/workflows/mdbook.yml

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,55 @@ concurrency:
2424
group: "pages"
2525
cancel-in-progress: false
2626

27+
env:
28+
MDBOOK_VERSION: 0.4.21
29+
MDBOOK_ALERTS_VERSION: 0.6.7
30+
MDBOOK_LINKCHECK_VERSION: 0.7.7
31+
PUBLISH_DOMAIN: component-model.bytecodealliance.org
32+
ARTIFACT_PATH: ./component-model/book/html
33+
2734
jobs:
28-
# Build job
2935
build:
3036
runs-on: ubuntu-latest
31-
env:
32-
MDBOOK_VERSION: 0.4.21
33-
MDBOOK_ALERTS_VERSION: 0.6.7
34-
MDBOOK_LINKCHECK_VERSION: 0.7.7
35-
PUBLISH_DOMAIN: component-model.bytecodealliance.org
3637
steps:
3738
- uses: actions/checkout@v3
3839
- name: Install mdBook
3940
run: |
4041
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
4142
rustup update
42-
cargo install --version ${MDBOOK_VERSION} mdbook
43-
cargo install --version ${MDBOOK_ALERTS_VERSION} mdbook-alerts
44-
cargo install --version ${MDBOOK_LINKCHECK_VERSION} mdbook-linkcheck
45-
- name: Setup Pages
46-
id: pages
47-
uses: actions/configure-pages@v3
43+
cargo install --version ${{ env.MDBOOK_VERSION }} mdbook
44+
cargo install --version ${{ env.MDBOOK_ALERTS_VERSION }} mdbook-alerts
45+
cargo install --version ${{ env.MDBOOK_LINKCHECK_VERSION }} mdbook-linkcheck
46+
4847
- name: Build with mdBook
4948
run: mdbook build component-model
49+
5050
- name: Setup Python
5151
uses: actions/setup-python@v5
5252
with:
5353
python-version: '3.13'
54+
55+
# Ensure the build generated properly
56+
- run: |
57+
if [[ ! -f "${{ env.ARTIFACT_PATH }}/index.html" ]]
58+
echo "[error] index.html @ [${{ env.ARTIFACT_PATH }}] is missing. Build or path misconfigured";
59+
exit 1;
60+
fi
61+
5462
- name: Generate sitemap
5563
run: |
56-
cd component-model
64+
cd ${{ env.ARTIFACT_PATH }}
5765
python3 ../scripts/generate_sitemap.py --domain "component-model.bytecodealliance.org" --higher-priority "design" --output-path book/sitemap.xml
5866
cd ..
67+
68+
- name: Setup Pages
69+
id: pages
70+
uses: actions/configure-pages@v3
71+
5972
- name: Upload artifact
6073
uses: actions/upload-pages-artifact@v3
6174
with:
62-
path: ./component-model/book/html
75+
path: ${{ env.ARTIFACT_PATH }}
6376

6477
# Deployment job
6578
deploy:

0 commit comments

Comments
 (0)