test:
  image: node:20
  script:
    - npm i
    - npm test
pages:
  image: node:20
  script:
    - apt update && apt install -y mkdocs-material jq moreutils
    - npm ci
    # Update version
    - jq ".version = \"$(git describe --tags --dirty | sed -e 's/^v//')\"" package.json | sponge package.json
    - mv pages-config.mjs config.mjs
    - npm run build
    - npm run build:examples-docs
    - npm run build:maplibre-examples-docs
    - npm run build:docs
    - npm run build:pages
    - find public -type f -regex '.*\.\(htm\|html\|xml\|txt\|text\|js\|css\|svg\)$' -exec gzip -f -k {} \;
  artifacts:
    paths:
    - public
  only:
  - develop
npm:
  image: node:20
  script:
    - npm version from-git --no-git-tag-version
    - npm publish
  only:
  - tags
