Deployment Plugin for Drone
Go to file
cupcakearmy eac78b17d6
Merge branch 'master' of https://github.com/CupCakeArmy/drone-deploy
2020-05-26 10:37:02 +02:00
.github funding 2020-05-26 10:36:59 +02:00
.dockerignore Cleaner output 2020-01-13 09:22:37 +01:00
.drone.yml test without 2019-05-25 17:16:41 +02:00
.gitignore Drone deploy plugin 2019-03-05 19:30:10 +01:00
Dockerfile Drone deploy plugin 2019-03-05 19:30:10 +01:00
LICENSE Initial commit 2019-03-05 19:20:56 +01:00
README.md Update README.md 2020-04-13 18:49:01 +02:00
main.py Cleaner output 2020-01-13 09:22:37 +01:00
requirements.txt Cleaner output 2020-01-13 09:22:37 +01:00

README.md

Drone Deployment Plugin

Quickstart 🚀

kind: pipeline
name: default

steps:
  
  - name: build
    image: node:11-alpine
    pull: always
    commands:
      - npm i
      - npm run build:prod

  - name: deploy
    image: cupcakearmy/drone-deploy
    pull: always
    settings:
      host: example.org
      user: root
      key:
        from_secret: ssh_key
      # or with a password
      # password: S3cr37Sh1zzl3
      port: 69
      target: /my/web/root/project
      sources:
        # To copy all the files
        # - . 
        - ./public
        - ./docker-compose.yml
        - ./docker-compose.prod.yml
      commands:
        - docker-compose -f docker-compose.yml -f docker-compose.prod.yml down
        - docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
    when:
      event: push
      branch: master

Details 📒

The plugins creates a tarball compressing all the files included inside of sources. Then the compressed tarball gets uploaded, extracted and deleted, leaving only the files specified by sources inside of the target folder. Afterwards all the commands inside of commands will get executed at the target directory.

Mapping remote environment variables 🗺

Sometimes it's usefull to have a remote env with a secret. Here is how.

kind: pipeline
name: default

steps:

  # build...

  - name: deploy
    image: cupcakearmy/drone-deploy
    pull: always
    settings:
      # host, user, port, key, when, target ...

      myvar: 'Something'
      somesecret:
        from_secret: mysecret
      envs:
        - myvar
        - somesecret
      commands:
        - echo $MYENV # Outputs: Something
        - echo $SOMESECRET # Outputs: Whatever is saved in drone as `mysecret`
Note

If you don't want to specify single variables just use envs: all and all the parameters inside of settings will be available.

All the vars will be automagically be uppercased.