Example for creating a simple CI/CD pipeline for a Python Project using Github Actions.
Now, You know how to create a Continous Integration with the help of workflow. But you had to deploy your application so that end user can see it. So to set a CI / CD where CI has already been configured, we had to set CD for the application. For that, Go to Heroku --> Download and Install Heroku CLI. Heroku CLI: https://devcenter.heroku.com/articles/heroku-cli Once done with the installation, you will get the commands to be run on the documentation page itself. Go to your systems cmd, run commands: heroku create
This is the default page, but you need to deploy your application over here:
Now, we want to deploy our updates on the above link. I can't do "git push heroku master" everytime. I want it to be automatically done when the build is passed ie., when the greencheck is available on the git hub repository.
For that I had to make a new Github action in order to deploy the code to heroku.
Also, in workflow we are using ubuntu machine which is unaware of the heroku credentials and whenever there be the automated build I cant provide my heroku credentials everytime. For that I'll create a token. For that follow the below steps:
Go to Documentation Page of Heroku --> Deployment --> Heroku CLI Commands --> heroku authorizations:create --> Run the command
I'll now put this Token in my GitHub repository which can then be used for authentication purpose. I can put this token in my workflow file as well but since my respoistory is public I'll save it somewhere else. Also If you don't want to showcase your application name you can do that as well with the below steps.
To add, follow the below steps:
Go to GitHub --> Settings --> Secrets --> Actions --> New Repository Secret -->
For API Name, https://desolate-atoll-01695.herokuapp.com/, use desolate-atoll-01695 in the HEROKU_API_NAME.
Now, put the following code in your workflow:
- name: Deploy to Heroku
env:
HEROKU_API_KEY:
