image: atlassian/default-image:4

pipelines:
  pull-requests:
    '**':
      - step:
          name: Code quality and tests
          image: ghcr.io/pierreribault/intranet-inside-node:20.8
          script:
            - eval `ssh-agent`
            - ssh-add $BITBUCKET_SSH_KEY_FILE
            - npm install
            - npm run lint
  branches:
    master:
      - step:
          name: Rebuild Satis
          script:
            - apt-get update && apt-get install -y curl
            - curl -d "{\"module\":\"$BITBUCKET_REPO_FULL_NAME\"}" -H "Content-Type:application/json" -X POST $SATIS_REBUILD_URL
    develop:
      - step:
          name: Rebuild Satis
          script:
            - apt-get update && apt-get install -y curl
            - curl -d "{\"module\":\"$BITBUCKET_REPO_FULL_NAME\"}" -H "Content-Type:application/json" -X POST $SATIS_REBUILD_URL

definitions:
  caches:
    npm: $HOME/.npm
