2023-10-02 01:02:25 +00:00
|
|
|
image: oven/bun:alpine
|
2016-02-29 14:25:06 +00:00
|
|
|
|
2023-10-02 00:58:34 +00:00
|
|
|
cache:
|
2018-10-28 08:16:18 +00:00
|
|
|
paths:
|
2023-10-02 00:58:34 +00:00
|
|
|
- node_modules/
|
2018-10-28 08:16:18 +00:00
|
|
|
|
2020-05-16 06:09:19 +00:00
|
|
|
variables:
|
|
|
|
NODE_ENV: "production"
|
|
|
|
|
2023-10-02 00:58:34 +00:00
|
|
|
# Rename to 'pages' for gitlab pages
|
2021-03-15 11:12:54 +00:00
|
|
|
build:
|
|
|
|
stage: build
|
2020-12-12 14:15:39 +00:00
|
|
|
|
2020-04-15 02:38:39 +00:00
|
|
|
before_script:
|
2021-03-15 11:12:54 +00:00
|
|
|
- apk update && apk add git
|
2023-10-02 01:02:25 +00:00
|
|
|
- bun install
|
2020-04-15 02:38:39 +00:00
|
|
|
|
2018-09-25 00:16:25 +00:00
|
|
|
script:
|
2023-10-02 00:58:34 +00:00
|
|
|
# Generate site
|
2023-10-02 01:02:25 +00:00
|
|
|
- bun run build
|
2021-03-12 08:04:58 +00:00
|
|
|
|
2019-12-23 23:36:51 +00:00
|
|
|
rules:
|
2023-10-02 00:57:04 +00:00
|
|
|
# Only trigger through push & "Run pipeline" events not in "site" branch; Skip in renovate job
|
|
|
|
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME != "site" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
2019-12-23 23:36:51 +00:00
|
|
|
when: always
|
2018-11-06 08:37:35 +00:00
|
|
|
|
2021-03-15 22:47:39 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public/
|
|
|
|
expire_in: 30 days
|
2020-12-12 09:06:16 +00:00
|
|
|
|
2021-03-15 11:12:54 +00:00
|
|
|
test:
|
|
|
|
stage: test
|
|
|
|
|
|
|
|
script:
|
2023-10-02 00:58:34 +00:00
|
|
|
# Homepage should exist and non-empty
|
|
|
|
- sh check-homepage.sh
|
2021-03-15 11:12:54 +00:00
|
|
|
|
|
|
|
rules:
|
|
|
|
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME == "master" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
|
|
when: always
|
|
|
|
|
2021-03-15 22:47:39 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public/
|
|
|
|
expire_in: 30 days
|
|
|
|
|
2021-03-15 11:12:54 +00:00
|
|
|
deploy:
|
2020-12-12 14:15:39 +00:00
|
|
|
stage: deploy
|
2021-03-15 11:12:54 +00:00
|
|
|
|
|
|
|
before_script:
|
|
|
|
- apk update && apk add openssh-client rsync
|
|
|
|
- mkdir -p ~/.ssh
|
|
|
|
- chmod 700 ~/.ssh
|
|
|
|
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
|
|
|
- chmod 644 ~/.ssh/known_hosts
|
|
|
|
- echo "$SSH_KEY_1" > ~/.ssh/id_host_1
|
|
|
|
- chmod 600 ~/.ssh/id_host_1
|
|
|
|
- echo "$SSH_KEY_2" > ~/.ssh/id_host_2
|
|
|
|
- chmod 600 ~/.ssh/id_host_2
|
|
|
|
- echo "$SSH_CONFIG" > ~/.ssh/config
|
|
|
|
- chmod 600 ~/.ssh/config
|
|
|
|
|
|
|
|
script:
|
|
|
|
- rsync -azvh --delete public/ host-1:/var/www/
|
|
|
|
- rsync -azvh --delete public/ host-2:/var/www/
|
|
|
|
|
2021-03-15 22:30:32 +00:00
|
|
|
rules:
|
|
|
|
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME == "master" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
|
|
when: always
|
|
|
|
|
|
|
|
deploy_pages:
|
|
|
|
stage: deploy
|
|
|
|
|
2020-12-12 14:15:39 +00:00
|
|
|
trigger:
|
|
|
|
project: curben/curben.gitlab.io
|
|
|
|
branch: master
|
2020-12-12 14:17:28 +00:00
|
|
|
strategy: depend
|
2021-03-15 22:30:32 +00:00
|
|
|
|
2020-12-12 14:15:39 +00:00
|
|
|
rules:
|
|
|
|
- if: '$RENOVATE != "true" && $CI_COMMIT_REF_NAME == "master" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
|
|
when: always
|
|
|
|
|
2023-10-02 00:58:34 +00:00
|
|
|
# Check dependency update
|
|
|
|
renovate:
|
2020-05-15 10:34:26 +00:00
|
|
|
before_script:
|
2020-07-12 07:41:20 +00:00
|
|
|
- apk update && apk add git
|
2023-10-02 01:02:25 +00:00
|
|
|
- bun install
|
2020-05-15 10:34:26 +00:00
|
|
|
|
2018-10-28 08:16:18 +00:00
|
|
|
script:
|
2023-10-02 01:02:25 +00:00
|
|
|
- bun install snyk @snyk/protect && bun run snyk
|
|
|
|
- bun install renovate && bun run renovate
|
2018-09-29 06:03:51 +00:00
|
|
|
|
2021-03-15 22:47:39 +00:00
|
|
|
# No artifact
|
|
|
|
dependencies: []
|
|
|
|
|
2019-12-23 23:36:51 +00:00
|
|
|
rules:
|
2020-12-12 14:15:39 +00:00
|
|
|
- if: '$RENOVATE == "true" && $CI_COMMIT_REF_NAME == "master" && ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web")'
|
2019-12-23 23:36:51 +00:00
|
|
|
when: always
|
2021-06-20 06:49:52 +00:00
|
|
|
|
|
|
|
include:
|
|
|
|
- template: Security/Secret-Detection.gitlab-ci.yml
|