mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-24 05:42:40 +08:00
update CI notes
This commit is contained in:
parent
3fa9362cd8
commit
8f90e5ad8b
69
README.md
69
README.md
@ -224,42 +224,47 @@ base_url = "http://confluence.local"
|
|||||||
|
|
||||||
# Tricks
|
# Tricks
|
||||||
|
|
||||||
## Confluence & Gitlab integration
|
## Continuous Integration
|
||||||
|
|
||||||
Mark was created with CI in mind so you can easily integrate mark into your
|
It's quite trivial to integrate Mark into a CI/CD system, here is an example with [Snake CI](https://snake-ci.com/)
|
||||||
pipeline, put the following code to your .gitlab-ci.yml in repository with your
|
in case of self-hosted Bitbucket Server / Data Center.
|
||||||
markdown docs:
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
stages:
|
stages:
|
||||||
- apply
|
- sync
|
||||||
|
|
||||||
Apply:
|
Sync documentation:
|
||||||
stage: apply
|
stage: sync
|
||||||
script:
|
only:
|
||||||
- files=($(
|
branches:
|
||||||
git diff
|
- main
|
||||||
$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA
|
image: kovetskiy/mark
|
||||||
--name-only
|
commands:
|
||||||
--diff-filter=ACMRT
|
- for file in $(find -type f -name '*.md'); do
|
||||||
| grep '.md$'
|
echo "> Sync $file";
|
||||||
));
|
mark -u $MARK_USER -p $MARK_PASS -b $MARK_URL -f $file || exit 1;
|
||||||
if [[ "${#files[@]}" == "0" ]]; then exit 0; fi;
|
echo;
|
||||||
set -e;
|
done
|
||||||
for file in ${files[@]}; do
|
|
||||||
echo;
|
|
||||||
echo "> Uploading ${file}";
|
|
||||||
docker run --rm -i -v=$(pwd):/docs
|
|
||||||
kovetskiy/mark:latest
|
|
||||||
mark
|
|
||||||
-u $DOCS_WIKI_USERNAME
|
|
||||||
-p $DOCS_WIKI_PASSWORD
|
|
||||||
-b $DOCS_WIKI_BASE_URL
|
|
||||||
-f ${file};
|
|
||||||
done
|
|
||||||
```
|
```
|
||||||
|
|
||||||
and declare the following environment variables (secrets)
|
In this example, I'm using the `kovetskiy/mark` image for creating a job container where the
|
||||||
* `DOCS_WIKI_USERNAME` — Username for access to Confluence
|
repository with documentation will be cloned to. The following command finds all `*.md` files and runs mark against them one by one:
|
||||||
* `DOCS_WIKI_PASSWORD` — Password for access to Confluence
|
|
||||||
* `DOCS_WIKI_BASE_URL` — Base URL of Confluence (cloud users should add /wiki at the end)
|
```bash
|
||||||
|
for file in $(find -type f -name '*.md'); do
|
||||||
|
echo "> Sync $file";
|
||||||
|
mark -u $MARK_USER -p $MARK_PASS -b $MARK_URL -f $file || exit 1;
|
||||||
|
echo;
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
The following directive tells the CI to run this particular job only if the changes are pushed into the
|
||||||
|
`main` branch. It means you can safely push your changes into feature branches without being afraid
|
||||||
|
that they automatically shown in Confluence, then go through the reviewal process and automatically
|
||||||
|
deploy them when PR got merged.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
only:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user