How do I automatically "create a deployment" after pushing code into GitHub?

image
image

I have created a pipeline that automates the process of opening & closing service-now tickets. I am using the “promote” feature for that pipeline currently.

the only issue I’m having is that after running the pipeline, I have to manually click on the “DEPLOY” button & fill out the information in “create a deployment” box to trigger the automation of tickets. (View pictures)

is there a way to automate this? to automatically create a deployment every time i update my code in GitHub?

The Deployment button is designed for teams that want to manually trigger a deployment. Since you want to automatically trigger a deployment every time you update code, you would just append steps to your standard pipeline that run your deployment tasks …

kind: pipeline
type: docker
name: default

steps:
  - name: build
    image: golang
    commands:
    - go build
    - go test

+ - name: deploy
+   image: ...
+   commands: ...  # your deployment tasks here

Thanks for your suggestion @ashwilliams1.

In this case, would the build be tagged as a promoted deployment, though?
I am currently doing this and having a deployment step just after building, however this sort of drops Drone’s deployment functionality as those are not listed under the deployment tab.

Ideally we could have:

steps:
  - name: build
    image: golang
    commands:
    - go build
    - go test

  # if build passes, promote it
  - name: promote
    image: ...
    commands: 
    - drone build promote

trigger:
  event: [push]
 
---
steps:
  - name: deploy
    image: ...
    commands: [...]

trigger:
  event: [promote]

and, then adding another pipeline responsible for only perform the deployment? Based on the promotion itself? This way we know that deployments always reflect what’s listed on Drone.

Would there be any way to trigger a promotion event from inside a pipeline, or perhaps, simply a way to tag a build as deployed by keeping the pipeline steps you have suggested?
Or perhaps you would have another suggestion?

Thanks in advance