diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..a10de5d6c244b1f69c09e042d909ecdadafdd17c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,58 @@ +image: "node:lts-alpine" + +stages: + - build + - deploy + + +# global cache settings for all jobs +# Ensure compatibility with the install job +# goal: the install job loads the cache and +# all other jobs can only use it +cache: + # most npm libraries will only have 1 entry for the base project deps + - key: &global_cache_node_mods + files: + - package-lock.json + paths: + - node_modules/ + policy: pull # prevent subsequent jobs from modifying cache + +# # ATTN mono-repo users: with only additional node_modules, +# # add up to 2 additional cache entries. +# # See limitations in #10. +# - key: +# files: +# - core/pkg1/package-lock.json +# paths: +# - core/pkg1/node_modules/ +# policy: pull # prevent jobs from modifying cache + +before_script: + # define cache dir & use it npm! + - npm ci --cache node_modules/ --prefer-offline +# # monorepo users: run secondary install actions +# - npx lerna bootstrap -- --cache .npm/ --prefer-offline + - npm run lint + + +build: + stage: build + # global cache settings are inherited to grab `node_modules` + script: + - npm run build + artifacts: + paths: + - dist/ # where ever your build results are stored + +pages: + stage: deploy + when: on_success # only if previous stages' jobs all succeeded + # override inherited cache settings since node_modules is not needed + script: + - echo 'Pages deployment job' + artifacts: + paths: + - dist + rules: + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH \ No newline at end of file