GitHub Actions is a feature available in GitHub that can create a custom automated workflow or in other words we can say, it is a built in continuous Integration and Continuous Delivery (CICD) tool for GitHub. GitHub Actions provides a set of features, including the ability to run workflows on different platforms like..Windows, macOS, Linux, it can also parallelize jobs, and trigger workflows based on a wide range of events.
Following are the steps to run the workflow through GitHub Actions:-
1. go to GitHub.com --->create new repository
2. go to your repository and click on Actions tab
3. Click on New Workflow
4. Here either you can create your own workflow after clicking on the link 'set up a workflow yourself' or you can choose a workflow from suggestions provided by GitHub under the heading 'Suggested for this repository'.
here for example I am selecting Java with Maven and click on Configure.
5. You will be directed to a page showing maven.yml file.
What is a yml file?
A YML file is designed in a format that is easily readable by humans as well as for machines to process and generate. It is commonly used for configuration of files and data exchange between programs. YML is often used in software development for configuration management, data representation, and defining data structure.
YML files use indentation to indicate the structure of the data, and it relies on whitespace to separate elements. Indentation is very important in YML. It defines the hierarchy and nesting of elements. Spaces can be used for indentation, but it should be consistent within the file.
When we create a workflow/ .yml file that specifies events, jobs, runners, steps and action. An event is a trigger for the workflow. A common event occurs in repository is when someone pushes new code and when an event occurs it going to run all the jobs within the workflow.
Workflows consist of one or more jobs, and each job contains a series of steps. Steps can be commands, scripts, or actions defined in separate reusable files.
6. Now edit the .yml file as per your workflow's requirement then commit and push the changes.
*** As for reference a line of code has been added below in the picture.
*** Since syntax and spacing is very important in a yml file so once you make any change, just make sure that the syntax is all correct in the file. To check this you can copy the file and go to any yml formatter on google. You can paste the content and format it with the help of formatter then you can use the formatted file from there.
7. Goto repo main page and click on "Actions" tab.
Select the workflow from left sidebar and click on it.
You can see run workflow option on the right side, click on it.
After clicking on run workflow, the build will start running and once run is complete you can
check the logs and results.
*** Pictures added step by step below as for reference