Skip to content

Commit 76cd39e

Browse files
authored
Merge pull request #1390 from sburris0/gitlabci
Guide: Add instructions for publishing via GitLab Pages
2 parents 09e7bb7 + 4615ce2 commit 76cd39e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

guide/src/continuous-integration.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,31 @@ deploy: book
124124
git commit -m "deployed on $(shell date) by ${USER}" && \
125125
git push origin gh-pages
126126
```
127+
128+
## Deploying Your Book to GitLab Pages
129+
Inside your repository's project root, create a file named `.gitlab-ci.yml` with the following contents:
130+
```yml
131+
stages:
132+
- deploy
133+
134+
pages:
135+
stage: deploy
136+
image: rust:alpine
137+
variables:
138+
CARGO_HOME: $CI_PROJECT_DIR/cargo
139+
before_script:
140+
- export PATH="$PATH:$CARGO_HOME/bin"
141+
- mdbook --version || cargo install mdbook
142+
script:
143+
- mdbook build -d public
144+
only:
145+
- master
146+
artifacts:
147+
paths:
148+
- public
149+
cache:
150+
paths:
151+
- $CARGO_HOME/bin
152+
```
153+
154+
After you commit and push this new file, GitLab CI will run and your book will be available!

0 commit comments

Comments
 (0)