Skip to content
Snippets Groups Projects
Select Git revision
  • 697ffd26d7c8774c9587efa1f7024d5d88c6db98
  • master default
  • test
3 results

license_checker.yml

Blame
  • license_checker.yml 1.35 KiB
    #do artifactory connections
    include: 
      - https://git.code.tecnalia.com/digicon-webxr-store/ci-files/-/raw/test/npm-packages/artifactory_connect.yml
    
    before_script:
      # Set PACKAGE_DIR to "." if not already defined. # PACKAGE_DIR should point to where the package.json file is
      - PACKAGE_DIR=${PACKAGE_DIR:-"."}
      # check if package.json exist on PACKAGE_DIR. If not, raise error
      - test -f $PACKAGE_DIR/package.json || (echo "package.json not found in $PACKAGE_DIR" && exit 1)
      - npm install -g js-green-licenses
      # check if js-green-licenses.json exist on PACKAGE_DIR. If not, inform user and continue
      - test -f $PACKAGE_DIR/js-green-licenses.json || (echo "js-green-licenses.json not found in $PACKAGE_DIR" && echo "Continuing with default configuration")
    
    license_check:
        stage: license-check
        tags:
          - docker
        image: $ACR_URL/node:18.12.0
        # cache build for the next jobs
        artifacts:
          untracked: true
          expire_in: 1h
          paths:
            - $PACKAGE_DIR/node_modules
            - $PACKAGE_DIR/package-lock.json
        script:
          # connect job from artifactory_connect.yml
          - !reference [.connect, script]   
          # Change to the directory containing package.json
          - cd $PACKAGE_DIR
          # install dependencies
          - jfrog rt npmi $NPM_REPO_URL
          - ls -la node_modules
          - jsgl --local ./ || exit 1
        only:
          - tags