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

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

parent 0bc478f6
No related branches found
No related tags found
No related merge requests found
...@@ -5,10 +5,34 @@ image: "rust:1.70-alpine3.17" ...@@ -5,10 +5,34 @@ image: "rust:1.70-alpine3.17"
before_script: before_script:
- apk add --no-cache musl-dev curl - apk add --no-cache musl-dev curl
- mkdir -p $HOME/.cargo/bin - 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 - 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 - 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: test:cargo:
script: script:
...@@ -21,3 +45,9 @@ run_test_doc: ...@@ -21,3 +45,9 @@ run_test_doc:
- cd ../book - cd ../book
- mdbook test - mdbook test
- mdbook build - 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 00](./part00.md)
- [Part 01](./part01.md) - [Part 01](./part01.md)
...@@ -22,4 +22,4 @@ $ mdbook build ...@@ -22,4 +22,4 @@ $ mdbook build
et vous retrouverez l'index dans le fichier et vous retrouverez l'index dans le fichier
```bash ```bash
$ book/index.html $ 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