nordic-skating / commit
ci: test, build and publish the default branch to GitLab Pages
.gitlab-ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..c99b0b7 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,25 @@ +image: node:22 + +stages: [test, deploy] + +test: + stage: test + script: + - npm ci + - npm test + - npm run build + +pages: + stage: deploy + script: + - npm ci + - npm run build + # GitLab Pages requires the artifact to be a directory named `public`. There is no + # `public/` in the repository (vite.config.ts), so this is a rename, not a nest. + - mv dist public + # Fail loudly rather than publishing a 404. + - test -f public/index.html || (echo "no index.html at artifact root" && exit 1) + artifacts: + paths: [public] + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH