language:
- node_js

node_js:
  - "lts/*"
  - "node"

jobs:
  include:
  - stage: test
    before_script:
    - 'curl -H ''Cache-Control: no-cache'' https://raw.githubusercontent.com/fossas/fossa-cli/master/install.sh | sudo bash'
    script:
    - yarn test
    after_success:
    - npm run coverage
    - fossa init
    - fossa analyze
  - stage: release
    node_js: lts/*
    script: skip
    before_install:
    - openssl aes-256-cbc -K $encrypted_907309497874_key -iv $encrypted_907309497874_iv -in .travis_gpg_key.asc.enc -out /tmp/travis_gpg_key.asc -d
    - chmod 600 /tmp/travis_gpg_key.asc
    - gpg --batch --yes --import /tmp/travis_gpg_key.asc
    - echo '/usr/bin/gpg --passphrase ${GPG_PASSPHRASE} --batch --no-tty "$@"' > /tmp/gpg-with-passphrase && chmod +x /tmp/gpg-with-passphrase
    - git config gpg.program "/tmp/gpg-with-passphrase"
    - git config commit.gpgsign true
    - git config --global user.signingkey ${GPG_KEY_ID}
    deploy:
      provider: script
      edge: true
      on:
        branch: master
      script:
      - npx semantic-release