patek.cz/.gitlab-ci.yml
2022-02-21 12:00:17 +01:00

88 lines
1.9 KiB
YAML

variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- docker-build
- lint_build_test
- deploy
lint:
stage: lint_build_test
image:
name: docker/compose:1.24.1
entrypoint:
- /bin/sh
- "-c"
services:
- docker:dind
variables:
DOCKER_HOST: "tcp://docker:2375/"
DOCKER_DRIVER: overlay2
GIT_SUBMODULE_STRATEGY: none
script:
- docker-compose pull
- docker-compose run xo-js-lint
- docker-compose run xo-html-lint
- docker-compose run sass-lint
build:
stage: lint_build_test
image:
name: klakegg/hugo:0.78.1-ext-alpine@sha256:7c2d3702546b5aaddf7f960d138715f12ba4b94906d9dfcc2d4a5a4e8c4cb760
entrypoint:
- /bin/sh
- "-c"
script:
- hugo --minify
artifacts:
paths:
- public
expire_in: 1 week
only:
- production
test:
stage: lint_build_test
image:
name: klakegg/hugo:0.78.1-ext-alpine@sha256:7c2d3702546b5aaddf7f960d138715f12ba4b94906d9dfcc2d4a5a4e8c4cb760
entrypoint:
- /bin/sh
- "-c"
script:
- hugo_output=$(hugo --path-warnings --i18n-warnings)
- echo "$hugo_output"
- if echo "$hugo_output" | grep -q 'i18n|MISSING_TRANSLATION'; then false; else true; fi
- if echo "$hugo_output" | grep -q 'WARN.*Duplicate target paths'; then false; else true; fi
artifacts:
paths:
- public
expire_in: 3 days
firebase-deploy:
stage: deploy
image: andreysenov/firebase-tools
dependencies:
- build
script:
- firebase deploy --only hosting
only:
- production
docker-build:
stage: docker-build
image:
name: docker/compose:1.24.1
entrypoint:
- /bin/sh
- "-c"
services:
- docker:dind
variables:
DOCKER_HOST: "tcp://docker:2375/"
DOCKER_DRIVER: overlay2
GIT_SUBMODULE_STRATEGY: none
when: manual
before_script:
- echo $CI_JOB_TOKEN | docker login -u gitlab-ci-token --password-stdin $CI_REGISTRY
script:
- docker-compose build
- docker-compose push