9 Commits

Author SHA1 Message Date
fc6bd36d2f docsy drone build fix 2020-11-14 23:10:53 +01:00
6fdf99b0f3 mermaid support fix 2020-09-10 16:04:13 +02:00
71f107e2ee mermaid support 2020-09-01 18:36:47 +02:00
07a3b7821a init 2020-09-01 18:08:20 +02:00
7ef0bd900e docsy support, init 2020-09-01 15:40:42 +02:00
050b220e7b docsy support 2020-09-01 15:37:40 +02:00
27fa3c7818 docsy support 2020-09-01 15:33:11 +02:00
5e86455eb4 clean 2020-08-31 19:12:46 +02:00
2bbdbaece5 new drone integration 2020-08-31 18:36:53 +02:00
6 changed files with 111 additions and 49 deletions

View File

@ -1,35 +1,33 @@
---
kind: pipeline
type: docker
name: default
trigger:
branch:
- master
steps:
- name: docker
image: plugins/docker
settings:
username:
from_secret: hub_username
password:
from_secret: hub_password
repo:
from_secret: hub_repo
tags: latest
when:
branch:
- master
- name: Budowanie dokcumentacji
image: paramah/hugo-deploy
commands:
- npm install -g postcss-cli
- npm install postcss autoprefixer
- git submodule update --init --recursive
- hugo --destination /drone/src/build
- minify -r -o /drone/src/build /drone/src/build
- name: notify
image: appleboy/drone-telegram
settings:
token:
from_secret: telegram_bot_token
to:
from_secret: telegram_group_id
message: >
{{#success build.status}}
build {{build.link}} triggerd by {{commit.link}} from {{commit.author}} succeeded
{{else}}
build {{build.link}} triggerd by {{commit.link}} from {{commit.author}} failed
{{/success}}
when:
status:
- success
- failure
- name: Deploy dokumentacji
image: paramah/hugo-deploy
commands:
- eval `ssh-agent -s`
- echo "$SSH_KEY" | ssh-add -
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- rsync -rv -e "ssh -p 65522" /drone/src/build/ $SSH_URI:$DEST --checksum
environment:
SSH_KEY:
from_secret: drone_ssh_key
SSH_URI:
from_secret: ssh_uri
DEST:
from_secret: destination

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
/public/
/resources/_gen/
hugo_stats.json
public/
resources/
node_modules/

View File

@ -1,19 +0,0 @@
# Drone docker deploy
## Użycie
```
cat ${args[0]} |awk -F\= '{system("drone secret add --repository='${args[1]}' --name="$1 " --data="$2)}'
```
Wymagane zmienne:
```
hub_username=
hub_password=
hub_repo=
telegram_bot_token=
telegram_group_id=
```

34
DOCSY_DEPLOY.md Normal file
View File

@ -0,0 +1,34 @@
# Docsy hugo deploy
Skrypt umożliwia szybki automatyczny deploy dokumentacji opartej o [docsy](https://www.docsy.dev/docs/).
# Zawiera
`.gitignore` dla hugo
`init.sh` skrypt inicjujący repozytorium dla docsy (subrepo dla tematu)
`.drone.yml` skrypt do automatycznego deploymentu
# Wymagania
- [drone.io cli](https://docs.drone.io/cli/install/)
- [hugo](https://gohugo.io/getting-started/installing/)
# Użycie
Musimy aktywować repozytorium na naszym drone.io
```
cat ${args[0]} |awk -F\= '{system("drone secret add --repository='${args[1]}' --name="$1 " --data="$2)}'
```
Wymagane zmienne:
```
domain=
site_path=
ssh_host=
ssh_username=
ssh_password=
ssh_port=
```

34
init_docsy.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
#
# Helper functions
#
declare -i term_width=120
h1() {
declare border padding text
border='\e[1;34m'"$(printf '=%.0s' $(seq 1 "$term_width"))"'\e[0m'
padding="$(printf ' %.0s' $(seq 1 $(((term_width - $(wc -m <<<"$*")) / 2))))"
text="\\e[1m$*\\e[0m"
echo -e "$border"
echo -e "${padding}${text}${padding}"
echo -e "$border"
}
h2() {
printf '\e[1;33m==>\e[37;1m %s\e[0m\n' "$*"
}
h1 "Inicjalizacja struktury hugo"
hugo new site --force ./
h1 "Inicjalizacja repozytorium git"
git init
h2 "Inicjalizacja submodułu z docsy"
git submodule add https://github.com/google/docsy.git themes/docsy
echo 'theme = "docsy"' >> config.toml
git submodule update --init --recursive
h1 "Obsłga mermaid"
mv tmp_layouts layouts
h1 "Czyszczenie repozytorium"
rm init_docsy.sh

View File

@ -0,0 +1,9 @@
<!-- MermaidJS support -->
<script async src="https://unpkg.com/mermaid@8.7.0/dist/mermaid.min.js"></script>
<div class="mermaid">
{{.Inner}}
</div>