From 0017706cd761b1eec6218dbbeebc5d6ed26b35dc Mon Sep 17 00:00:00 2001 From: Christophe Chaudier <christophe@lydra.fr> Date: Thu, 13 Apr 2023 15:34:38 +0200 Subject: [PATCH] ci: publish on gitlab registry --- .gitlab-ci.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ .nvmrc | 1 + vercel.json | 7 +++++++ vite.config.js | 8 ++++++++ 4 files changed, 59 insertions(+) create mode 100644 .gitlab-ci.yml create mode 100644 .nvmrc create mode 100644 vercel.json create mode 100644 vite.config.js diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..3b33cb2 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,43 @@ +--- +image: node:lts-slim + +stages: + - test + - build + - deploy + +variables: + NPM_ORGANIZATION: lydra + +cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - node_modules/ + +before_script: + - npm ci + +pages: + stage: build + script: + - npm run build + - mv public public.dist + - mv dist public + artifacts: + paths: + - public + +publish_gitlab_registry: + stage: deploy + needs: + - job: pages + artifacts: true + dependencies: + - pages + script: + - npm config set ${NPM_ORGANIZATION}:registry //lab.frogg.it/api/v4/projects/${CI_PROJECT_ID}/packages/npm/ + - npm config set -- '//lab.frogg.it/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}' + - npm config set -- '//lab.frogg.it/api/v4/packages/npm/:_authToken={CI_JOB_TOKEN}' + - npm publish + # rules: + # - if: $CI_COMMIT_TAG diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..e44a38e --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v18.12.1 diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..9276941 --- /dev/null +++ b/vercel.json @@ -0,0 +1,7 @@ +{ + "rewrites": [ + { "source": "/(.*)", "destination": "/index.html" } + ], + "buildCommand": "npm run build", + "outputDirectory": "dist" +} diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..c83c3df --- /dev/null +++ b/vite.config.js @@ -0,0 +1,8 @@ +// vite.config.js +// https://vitejs.dev/guide/static-deploy.html#gitlab-pages-and-gitlab-ci + +const URL = process.env.BASE_URL || '/'; + +export default { + base: `${URL}` +} -- GitLab