saiblog/.gitlab-ci.yml

108 lines
2.4 KiB
YAML
Raw Normal View History

# 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:
- build
- package
- test
2021-01-02 21:34:32 +01:00
- deploy
build:
2023-09-02 23:57:48 +02:00
image: docker.io/library/node:20.5
stage: build
before_script:
2023-09-02 23:58:31 +02:00
- npm install -g pnpm
2022-10-23 12:08:29 +02:00
- pnpm config set store-dir .pnpm-store
script:
2022-10-23 12:08:29 +02:00
- pnpm install # install dependencies
- pnpm run build
cache:
key:
files:
- pnpm-lock.yaml
paths:
- .pnpm-store
package:
stage: package
image: quay.io/sheogorath/build-ah-engine:latest
tags:
- privileged
variables:
LANG: C.UTF-8
before_script:
- podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
2022-10-23 12:34:57 +02:00
- 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
tags:
- privileged
before_script:
- podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
2022-10-23 12:34:57 +02:00
- podman build --pull -f .docker/Dockerfile -t "$CI_REGISTRY_IMAGE" .
- podman push "$CI_REGISTRY_IMAGE"
only:
- deploy
test:
stage: test
2020-08-13 05:52:29 +02:00
tags:
- privileged
image: quay.io/sheogorath/build-ah-engine:latest
variables:
LANG: C.UTF-8
before_script:
- dnf install curl
script:
2020-08-06 01:14:18 +00:00
- 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
2020-08-06 01:14:18 +00:00
- curl http://localhost:8080/status.txt | grep -q 'OK'
- podman stop testing
- podman rm testing
except:
- deploy
test-deploy:
stage: test
2020-08-13 05:52:29 +02:00
tags:
- privileged
image: quay.io/sheogorath/build-ah-engine:latest
variables:
LANG: C.UTF-8
before_script:
- dnf install curl
script:
2020-08-06 01:14:18 +00:00
- podman run -d -p 8080:80 --name testing $CI_REGISTRY_IMAGE:latest
- sleep 5
- podman exec testing nginx -c /etc/nginx/nginx.conf -t
2020-08-06 01:14:18 +00:00
- curl http://localhost:8080/status.txt | grep -q 'OK'
- podman stop testing
- podman rm testing
only:
- deploy
2021-01-02 21:34:32 +01:00
deploy:
stage: deploy
variables:
PLAYBOOK: static_websites.yml
trigger:
project: saibotk.de/infrastructure-private
strategy: depend
only:
- deploy