# This is a sample build configuration for Javascript.
# Check our guides at https://confluence.atlassian.com/x/VYk8Lw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: spittet/node-postgresql

pipelines:
  default:
    - step:
        script: # Modify the commands below to build your repository.           
          - /etc/init.d/postgresql start # starting the service
          - sudo -u postgres sh -c 'createuser test -s & createdb test_db' # creating a root user 
          - sudo -u postgres psql -c "ALTER USER test PASSWORD 'password';" # setting up the root password
          - npm install
          - npm test
  branches:
    feature/config:
      - step:
          script: # Modify the commands below to build your repository.    
          - /etc/init.d/postgresql start # starting the service
          - sudo -u postgres sh -c 'createuser test -s & createdb test_db' # creating a root user 
          - sudo -u postgres psql -c "ALTER USER test PASSWORD 'password';" # setting up the root password
          - npm install
          - npm test
          - node ./npmPublisher # automatically published the npm package
          - npm set init.author.name “Holition”
          - npm set init.author.email “admin@holition.com”
          - npm set init.author.url "www.holition.com"