mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
API doc: enable CI
This commit is contained in:
parent
367ead0fb8
commit
dbf98f56d6
3 changed files with 66 additions and 6 deletions
51
.gitlab-ci.yml
Normal file
51
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
variables:
|
||||||
|
DEPLOY_USER: deploy
|
||||||
|
DEPLOY_HOST: acs-os-fein-website
|
||||||
|
DEPLOY_PATH: /var/www/villas/api/web/
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- prepare
|
||||||
|
- doc
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
# Stage: prepare
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Build docker image which is used to build & test VILLASnode
|
||||||
|
prepare:redoc:
|
||||||
|
stage: prepare
|
||||||
|
script:
|
||||||
|
- docker build -f doc/api/Dockerfile -t redoc .
|
||||||
|
tags:
|
||||||
|
- shell
|
||||||
|
- linux
|
||||||
|
|
||||||
|
# Stage: doc
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
doc:api:
|
||||||
|
stage: doc
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
image: redoc
|
||||||
|
script:
|
||||||
|
- cd doc/api
|
||||||
|
- redoc-cli bundle --cdn --title "VILLASweb Backend API Documentation" --output index.html api.yaml
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- doc/api/index.html
|
||||||
|
|
||||||
|
# Stage: deploy
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
deploy:upload:
|
||||||
|
stage: deploy
|
||||||
|
script:
|
||||||
|
- cd doc/api
|
||||||
|
- rsync --copy-links --chown ${DEPLOY_USER}:${DEPLOY_USER} index.html api.yaml ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}
|
||||||
|
dependencies:
|
||||||
|
- doc:api
|
||||||
|
# only:
|
||||||
|
# - master
|
||||||
|
tags:
|
||||||
|
- shell
|
3
doc/api/Dockerfile
Normal file
3
doc/api/Dockerfile
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
FROM node:8
|
||||||
|
|
||||||
|
RUN npm -g install redoc-cli
|
|
@ -1,14 +1,20 @@
|
||||||
REDOC := $(shell command -v redoc-cli 2> /dev/null)
|
TITLE := "VILLASweb Backend API Documentation"
|
||||||
|
|
||||||
|
DEPLOY_USER ?= deploy
|
||||||
|
DEPLOY_HOST ?= acs-os-fein-website
|
||||||
|
DEPLOY_PATH ?= /var/www/villas/api/web/
|
||||||
|
|
||||||
|
RSYNC_OPTS ?= --recursive --ignore-missing-args --copy-links --chown $(DEPLOY_USER):$(DEPLOY_USER)
|
||||||
|
|
||||||
all: index.html
|
all: index.html
|
||||||
|
|
||||||
index.html: api.yaml
|
index.html: api.yaml
|
||||||
ifndef REDOC
|
redoc-cli bundle --cdn --title "$(TITLE)" --output $@ api.yaml
|
||||||
$(error "redoc-cli is not available, please install via npm install -g redoc-cli (run as root)")
|
|
||||||
endif
|
deploy: index.html
|
||||||
redoc-cli bundle -o villaswebapi.html api.yaml
|
rsync $(RSYNC_OPTS) index.html api.yaml $(DEPLOY_USER)@$(DEPLOY_HOST):$(DEPLOY_PATH)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf index.html
|
rm -rf index.html
|
||||||
|
|
||||||
.PHONY: docs index.html clean
|
.PHONY: docs clean deploy
|
||||||
|
|
Loading…
Add table
Reference in a new issue