From 810fbec26ed9eb5fe4decedc859138e8a4e56585 Mon Sep 17 00:00:00 2001 From: s60171909 Date: Thu, 12 Oct 2023 09:25:03 +0900 Subject: [PATCH 1/3] Add .gitlab-ci.yml file --- .gitlab-ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..a948e03 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,24 @@ +image: "node:lts-alpine" + +stages: + - build + - deploy + +before_script: + - npm run install + - npm run lint + +build: + stage: build + script: + - npm run build + +pages: + stage: deploy + script: + - echo 'Pages deployment job' + artifacts: + paths: + - dist + rules: + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH -- GitLab From a656749009be501c0d54b7bb5c4880b27322778b Mon Sep 17 00:00:00 2001 From: s60171909 Date: Thu, 12 Oct 2023 09:26:30 +0900 Subject: [PATCH 2/3] Typo --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a948e03..7a2ab63 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ stages: - deploy before_script: - - npm run install + - npm install - npm run lint build: -- GitLab From c446f4de5cad9620bccdb3fca1df10c23a3497b0 Mon Sep 17 00:00:00 2001 From: s60171909 Date: Thu, 12 Oct 2023 09:56:13 +0900 Subject: [PATCH 3/3] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7a2ab63..a10de5d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,21 +4,55 @@ 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: - - npm install - - npm run lint + # 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 + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH \ No newline at end of file -- GitLab