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

**URL:** https://drone.discourse.group/t/how-do-i-automatically-create-a-deployment-after-pushing-code-into-github/11485
**Category:** Drone Support
**Created:** [July 14, 2020, 12:28pm UTC](https://drone.discourse.group/t/how-do-i-automatically-create-a-deployment-after-pushing-code-into-github/11485 "2020-07-14T12:28:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Moinch](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/moinch/32/4651_2.png) [@Moinch](https://drone.discourse.group/u/Moinch)
#### Post date: [July 14, 2020, 12:28pm UTC](https://drone.discourse.group/t/how-do-i-automatically-create-a-deployment-after-pushing-code-into-github/11485/1 "2020-07-14T12:28:16Z")

</div>

![image](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/d/d633fe107ce6643a45179c2f4ed233a903079008.png)  
 ![image](https://canada1.discourse-cdn.com/flex003/uploads/testdrone/original/2X/1/1f4e05b8ab2f93874983ef0d02aea8ff1b842ba5.png)

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?

---

<div class="post-metadata">

### Author: ![ashwilliams1](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/ashwilliams1/32/5549_2.png) [@ashwilliams1](https://drone.discourse.group/u/ashwilliams1)
#### Post date: [July 14, 2020, 1:05pm UTC](https://drone.discourse.group/t/how-do-i-automatically-create-a-deployment-after-pushing-code-into-github/11485/2 "2020-07-14T13:05:25Z")

</div>

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 …

```diff
kind: pipeline
type: docker
name: default

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

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

```

---

<div class="post-metadata">

### Author: ![zanona](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/zanona/32/2624_2.png) [@zanona](https://drone.discourse.group/u/zanona)
#### Post date: [October 18, 2020, 9:17am UTC](https://drone.discourse.group/t/how-do-i-automatically-create-a-deployment-after-pushing-code-into-github/11485/3 "2020-10-18T09:17:12Z")

</div>

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:

```auto
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
