image: node:22 stages: - test - publish cache: # The cache is shared for same values of cache key # Here, we use CI_PIPELINE_ID which is defined as: # "The instance-level ID of the current pipeline. This ID is unique across all projects on the GitLab instance." # This should ensure that we only cache the "node_modules" folder for this given pipeline instance. # Refer to this docs to know more about the predefined variables used in the key here: https://docs.gitlab.com/ee/ci/variables/predefined_variables.html key: $CI_PIPELINE_ID # configure the path to be cached paths: - node_modules/ before_script: - npm install - npm run build test: stage: test script: - npm run test - npm run madge publish:development: # Configure what tag to use for this publication. variables: NPM_TAG: 'development' script: # set our npm token and then use lerna to publish all packages that are not marked as "private". - npm config set //registry.npmjs.org/:_authToken ${NPM_AUTH_TOKEN} # Publish Primitives # NOTE: The "sed" command will append the JOB_ID version to the current package.json. # TODO: Simplify this in future or use Lerna's "publish" command. - (cd ./packages/primitives && sed -i -r "/version/s/([0-9\.]+)/\1-${NPM_TAG}.${CI_JOB_ID}/g" package.json && npm publish --access public --tag ${NPM_TAG}) - (cd ./packages/stack && sed -i -r "/version/s/([0-9\.]+)/\1-${NPM_TAG}.${CI_JOB_ID}/g" package.json && npm publish --access public --tag ${NPM_TAG}) only: - development # Publish the documentation to GitLab Pages (for now). pages: stage: publish script: - npm run docs:build - mv packages/docs/dist public artifacts: paths: - public only: - development