kind: pipeline
name: Build Image

steps:
  - name: Lint Check
    image: node:21-alpine
    commands:
      - npm install
      # - npm run lint

  - name: Build Docker Image
    image: plugins/docker
    settings:
      build_args: ''
      username:
        from_secret: docker_username
      password:
        from_secret: docker_password
      repo: git.midastix.com/ci-docker-repo-user/gemtrack-frontend
      registry: git.midastix.com
    when:
      branch:
        - main
      event:
        - push

  - name: Deploy image
    image: appleboy/drone-ssh
    settings:
      host: gemtrack.midastix.com
      username: gemtrack
      key:
        from_secret: server_ssh_pkey2
      port: 22
      command_timeout: 3m
      script:
        - echo "Deploying image"
        - sudo /opt/deployable/gemtrack-frontend/docker/deploy.sh
        - echo "Completed Deployment"
    when:
      branch:
        - main
      event:
        - push
# trigger:
#   branch:
#     - main
#     - feature/api_dev
#     - feature/openapi
#     - feature/oem_apis
#   event:
#     - push
