Something went wrong on our end
-
Henrik Askjer authoredHenrik Askjer authored
.gitlab-ci.yml 5.24 KiB
stages:
- build
- deploy
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_COMMIT_TAG == null'
when: never
- if: '$CI_COMMIT_BRANCH'
- if: $CI_COMMIT_TAG != null
build-dev:
image: node:16
tags:
- spraaksamlingene_01
stage: build
rules:
- if: $CI_COMMIT_TAG != null
when: never
- if: $CI_COMMIT_REF_NAME == 'prod'
when: manual
- when: on_success
script:
- |-
if [[ $CI_PIPELINE_SOURCE == "merge_request_event" ]]; then
echo "VUE_APP_RELEASE=MERGE $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME ($CI_COMMIT_SHORT_SHA)" >> .env.dev_server
else
echo "VUE_APP_RELEASE=BRANCH $CI_COMMIT_BRANCH ($CI_COMMIT_SHORT_SHA)" >> .env.dev_server
fi
- npm install --progress=false
- npm run build -- --mode dev_server
- 'echo -e "\nDisallow: /" >> dist/robots.txt'
artifacts:
expire_in: 1 week
paths:
- dist
build-prod:
image: node:16
tags:
- spraaksamlingene_01
stage: build
only:
- /^release_.*$/
script:
- echo "VUE_APP_RELEASE=$CI_COMMIT_REF_NAME" >> .env.production
- npm install --progress=false
- npm run build -- --mode production
- 'echo -e "\nDisallow: /" >> dist/robots.txt'
- 'echo -e "\nAllow: /index.html" >> dist/robots.txt'
- 'echo -e "\nAllow: /css/" >> dist/robots.txt'
- 'echo -e "\nAllow: /js/" >> dist/robots.txt'
artifacts:
expire_in: 1 week
paths:
- dist
deploy-dev:
image: uibit/awscli:latest
tags:
- spraaksamlingene_01
stage: deploy
rules:
- if: $CI_COMMIT_TAG != null
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_PIPELINE_SOURCE == 'merge_request_event'
when: on_success
- if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != 'merge_request_event'
when: manual