GitHub Actions
INTRODUCTION
GitHub Actions helps you automate your software development workflows from within GitHub. You can deploy workflows in the same place where you store code and collaborate on pull requests and issues. In GitHub Actions, a workflow is an automated process that you set up in your GitHub repository. You can build, test, package, release, or deploy any project on GitHub with a workflow. Each workflow is made up of individual actions that run after a specific event (like a pull request) occur. The individual actions are packaged scripts that automate software development tasks.
Setup a workflow
- User should have admin access of GitHub repository
- Go to repository -> Actions -> New Workflow
- After then , you can choose & configure any template based on your requirement
- yml file will be created as above in .github/workflows/example.yml
GITHUB SECRETS
Secrets are encrypted variables that you create in an organization, repository, or repository environment.
- Settings -> Secrets and Variables -> Actions -> repository secrets
- Use secrets in workflow
- Use secrets in spring boot application- We can get these secrets in our code as an environment variables
ENVIRONMENTS
- We can create environments like dev, test, prod etc. for setting up the pipeline as- Settings -> Environments -> New Environments
- There are protection rules
- We can select deployment branches also
- There are environment specific secrets , can be created if required