114 lines
2.7 KiB
YAML
114 lines
2.7 KiB
YAML
# Pipeline for saiblog
|
|
# inspired by https://git.shivering-isles.com/shivering-isles/blog/-/blob/deploy/.gitlab-ci.yml
|
|
|
|
image: quay.io/sheogorath/build-ah-engine:latest
|
|
|
|
variables:
|
|
GIT_SUBMODULE_STRATEGY: recursive
|
|
|
|
stages:
|
|
- orthography
|
|
- build
|
|
- package
|
|
- test
|
|
- deploy
|
|
|
|
spellcheck:
|
|
stage: orthography
|
|
image: docker.io/library/node:15.12
|
|
before_script:
|
|
- npm i -g markdown-spellcheck
|
|
script:
|
|
- mdspell -r -n -a --en-gb "content/posts/*.md" "content/posts/*.markdown"
|
|
|
|
build:
|
|
image: docker.io/cibuilds/hugo:0.81
|
|
stage: build
|
|
variables:
|
|
HUGO_ENV: production
|
|
LANG: C.UTF-8
|
|
before_script:
|
|
- hugo --minify --enableGitInfo
|
|
script:
|
|
- htmlproofer ./public --allow-hash-href --check-html --empty-alt-ignore --disable-external
|
|
artifacts:
|
|
untracked: true
|
|
paths:
|
|
- public
|
|
expire_in: 1 week
|
|
|
|
package:
|
|
stage: package
|
|
image: quay.io/sheogorath/build-ah-engine:latest
|
|
variables:
|
|
LANG: C.UTF-8
|
|
before_script:
|
|
- podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
|
script:
|
|
- podman build --pull -f _docker/Dockerfile -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
|
|
- podman push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
|
|
except:
|
|
- deploy
|
|
|
|
package-deploy:
|
|
stage: package
|
|
image: quay.io/sheogorath/build-ah-engine:latest
|
|
variables:
|
|
LANG: C.UTF-8
|
|
before_script:
|
|
- podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
|
script:
|
|
- podman build --pull -f _docker/Dockerfile -t "$CI_REGISTRY_IMAGE" .
|
|
- podman push "$CI_REGISTRY_IMAGE"
|
|
only:
|
|
- deploy
|
|
|
|
test:
|
|
stage: test
|
|
tags:
|
|
- dind
|
|
- docker
|
|
image: quay.io/sheogorath/build-ah-engine:latest
|
|
variables:
|
|
LANG: C.UTF-8
|
|
before_script:
|
|
- dnf install curl
|
|
script:
|
|
- podman run -d -p 8080:80 --name testing $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
|
- sleep 5
|
|
- podman exec testing nginx -c /etc/nginx/nginx.conf -t
|
|
- curl http://localhost:8080/status.txt | grep -q 'OK'
|
|
- podman stop testing
|
|
- podman rm testing
|
|
except:
|
|
- deploy
|
|
|
|
test-deploy:
|
|
stage: test
|
|
tags:
|
|
- dind
|
|
- docker
|
|
image: quay.io/sheogorath/build-ah-engine:latest
|
|
variables:
|
|
LANG: C.UTF-8
|
|
before_script:
|
|
- dnf install curl
|
|
script:
|
|
- podman run -d -p 8080:80 --name testing $CI_REGISTRY_IMAGE:latest
|
|
- sleep 5
|
|
- podman exec testing nginx -c /etc/nginx/nginx.conf -t
|
|
- curl http://localhost:8080/status.txt | grep -q 'OK'
|
|
- podman stop testing
|
|
- podman rm testing
|
|
only:
|
|
- deploy
|
|
|
|
deploy:
|
|
stage: deploy
|
|
variables:
|
|
PLAYBOOK: static_websites.yml
|
|
trigger:
|
|
project: saibotk.de/infrastructure-private
|
|
strategy: depend
|
|
only:
|
|
- deploy
|