Creating a simple CI/CD Pipeline using GitHub Actions for Python Project using GitHub Actions.
Actions are individual tasks that we can combine to create jobs and customize our workflow. We can create our own actions, and use and customize actions shared by the GitHub community. Refer : https://github.com/features/actions
Details:
Continuous integration (CI) is a software practice that requires frequently committing code to a shared repository.When we commit code to our repository, we can continuously build and test the code to make sure that the commit doesn't introduce errors. Our tests can include code linters (which check style formatting), security checks, code coverage, functional tests, and other custom checks.
Building and testing our code requires a server. We can build and test updates locally before pushing code to a repository, or we can use a CI server that checks for new code commits in a repository.
GitHub offers CI workflow templates for a variety of languages and frameworks. Browse the complete list of CI workflow templates offered by GitHub in the actions/starter-workflows repository.
Details:
Continuous deployment is a strategy for software releases wherein any code commit that passes the automated testing phase is automatically released into the production environment, making changes that are visible to the software's users.- Install Heroku CLI
- Login to Heroku CLI session: heroku login
- Create new Heroku App: heroku create
- Generate Authentication Token: heroku authorizations:create
- 'Deploy to Heroku' Action:
yml
- name: Deploy to Heroku
env:
HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }}
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }}
if: github.ref == 'refs/heads/master' && job.status == 'success'
run: |
git remote add heroku https://heroku:$HEROKU_API_TOKEN@git.heroku.com/$HEROKU_APP_NAME.git
git push heroku HEAD:master -f