kind: pipeline
type: docker
name: build-and-deploy

steps:
  - name: build
    image: node:lts-bullseye
    commands:
    - apt-get update -y && apt-get install git -y
    - yarn && yarn build
  
  - name: upload
    image: plugins/s3
    settings:
      bucket: home-app
      region: us-ashburn-02
      acl: public-read
      endpoint: https://storage.186526.xyz
      access_key:
        from_secret: s3_access_key
      secret_key:
        from_secret: s3_secret_key
      source: dist/**/*
      target: /dist
      path_style: true
  
  - name: docker  
    image: plugins/docker
    settings:
      username:
        from_secret: docker_username
      password: 
        from_secret: docker_password
      auto_tag: true
      repo: registry.186526.xyz/home-app
      registry: registry.186526.xyz
  
  - name: notification
    image: appleboy/drone-telegram
    settings:
      token: 
        from_secret: telegram_bot_token
      to: real186526