Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.3 KiB
Newer Older
CaTasTrOOf's avatar
CaTasTrOOf committed
stages:
CaTasTrOOf's avatar
CaTasTrOOf committed
  - build
CaTasTrOOf's avatar
CaTasTrOOf committed

check-i18n:
  image: debian:latest
  stage: tests
CaTasTrOOf's avatar
CaTasTrOOf committed
  script:
    - apt update
    - apt --yes install jq
    - bash utils/findMissingI18nKeys.sh
CaTasTrOOf's avatar
CaTasTrOOf committed

  image: node:20-bullseye
  stage: tests
  script:
    - npm install
    - npm run build

generate:
  image: node:20-bullseye
CaTasTrOOf's avatar
CaTasTrOOf committed
  stage: build
  script:
    - npm install
    - npm run build
    - yarn generate
  artifacts:
    paths:
      - dist
    expire_in: 2 days
  rules:
    - if: $CI_COMMIT_TAG
      when: manual

pages:
  stage: publish
  needs: ["generate"]
  script:
    - ls dist
  artifacts:
    paths:
      - dist
    expire_in: 1 week
  rules:
    - if: $CI_COMMIT_TAG
poka's avatar
poka committed

endpoint_check:
  image: node:20-bullseye
  stage: build
  script:
    - |
      if git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA | grep -q "endpoints.json"; then
        npm install
        node graphql/generateEndpoints.js
        git config --global user.email "ci@duniter.org"
        git config --global user.name "CI Bot"
        git add -A
        git commit -m "Auto-update generated endpoints"
        git push https://gitlab-ci-token:${CI_PUSH_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git HEAD:$CI_COMMIT_REF_NAME
      else
        echo "No changes in endpoints.json"
      fi
  rules:
    - changes:
        - endpoints.json