Skip to content
Snippets Groups Projects
Commit 5c620670 authored by orestis.malaspin's avatar orestis.malaspin
Browse files

Merge branch '16-add-ci-cd-for-deployment-of-the-book' into 'main'

Resolve "Add CI/CD for deployment of the book."

Closes #16

See merge request orestis.malaspin/rust-101!28
parents 0bc478f6 906c9cd0
No related branches found
No related tags found
No related merge requests found
......@@ -5,10 +5,34 @@ image: "rust:1.70-alpine3.17"
before_script:
- apk add --no-cache musl-dev curl
- mkdir -p $HOME/.cargo/bin
- which rustc
- which cargo
- curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.31/mdbook-v0.4.31-x86_64-unknown-linux-musl.tar.gz | tar -xz --directory=$HOME/.cargo/bin
- export PATH=$PATH:$HOME/.cargo/bin
##
## Install ssh-agent if not already installed, it is required by Docker.
##
- 'which ssh-agent || (apk add --update openssh-client)'
- 'which rsync || (apk add --update rsync)'
- 'which chmod || (apk add --update chmod)'
##
## Run ssh-agent (inside the build environment)
##
- eval $(ssh-agent -s)
##
## Give the right permissions, otherwise ssh-add will refuse to add files
## Add the SSH key stored in SSH_PRIVATE_KEY file type CI/CD variable to the agent store
##
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
##
## Create the SSH directory and give it the right permissions
##
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
##
## Assuming you created the SSH_KNOWN_HOSTS file type CI/CD variable, uncomment the
## following two lines.
##
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
test:cargo:
script:
......@@ -21,3 +45,9 @@ run_test_doc:
- cd ../book
- mdbook test
- mdbook build
run_deploy_book:
script:
- cd book
- mdbook build
- rsync -avz book/* ur1bg_malas@ur1bg.ftp.infomaniak.com:web/malaspinas/rust-101/
# Sommaire
# Summary
- [Part 00](./part00.md)
- [Part 01](./part01.md)
......@@ -22,4 +22,4 @@ $ mdbook build
et vous retrouverez l'index dans le fichier
```bash
$ book/index.html
```
\ No newline at end of file
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment