Provide Review Apps in MRs

This commit is contained in:
Gregor Kleen 2023-05-13 16:48:39 +00:00
parent 3fee7cd8b3
commit a132d6bf4c
2 changed files with 28 additions and 6 deletions

View File

@ -2,7 +2,8 @@ image: nixpkgs/nix-flakes
workflow:
rules:
- if: $CI_COMMIT_BRANCH
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_MERGE_REQUEST_ID
variables:
STACK_ROOT: "${CI_PROJECT_DIR}/.stack-root"
@ -13,6 +14,10 @@ cache:
- .stack-root
- _cache
stages:
- review
- deploy
pages:
stage: deploy
script: &build-script
@ -21,13 +26,30 @@ pages:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
test:
stage: test
review:start:
stage: review
script: *build-script
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH != "main"
- if: $CI_MERGE_REQUEST_ID
environment:
name: preview/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}
url: https://${CI_PROJECT_NAMESPACE}.pages.uniworx.de/-/${CI_PROJECT_NAME}/-/jobs/${CI_JOB_ID}/artifacts/public/index.html
auto_stop_in: 2 weeks
on_stop: review:stop
review:stop:
stage: review
rules:
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true
environment:
name: preview/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}
action: stop
script:
- echo 'Terminating review app'

View File

@ -1,5 +1,5 @@
#!/usr/bin/env sh
gup --always
yarn install
yarn install --frozen-lockfile --check-files --non-interactive
touch node_modules