GitHub Actions and Their Workflows: A Beginner's Guide to CI/CD with a Sample Program

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys welcome back to my channel again in this video we're going to talk about GitHub actions so why GitHub actions are you know required what is cicd automations and all those things okay so first thing GitHub actions are called as automations in GitHub so we'll be using uh for whatever you're building your project or uh it might be like sending to your files to some other servers or adding it to you can utilize whatever the actions we have it is you know applicable in GitHub okay so we have multiple actions in GitHub so we'll go one by one each and everything so first we'll go with the basics of creating a small cicd uh let's see how it will be created if you want more details on cicd uh cicd is nothing but you know continuous integration and continuous deployment or we can say yeah continuous deployment or delivery we'll go with one example let's say okay you have a huge project for that first of all you have to build your project and then you have to copy it to some you know some servers and all those things and you have to run it doing this uh it might take uh more than 2 hours or 3 hours uh Max to Max okay so we can't keep on you know dependent on one right so if you have multiple projects let's say like this all Engineers can't you know keep on building it and you know copy those files manually and deploy it in a server for doing this uh this hustle you know reducing this hustle and all those things this cicd came into picture all this whatever we'll be saying that this comes into platform called as devops so devops Engineers usually build this tools okay CD yaml files it will be like a document file where uh it'll automate your things it will do your jobs easy first of all it will build all the project whatever you have uh let's say let's take an example of Maven project okay so if Maven project is there it's indirectly you know we can say that as a Java project or Scala project or griddle or also we can say spring boot so on so so those projects we have to build a jar right Java then we have to copy that to uh servers and then we have to run it so for doing this it will be like a huge efforts from the users so what they will do they will make a cicd and they'll uh they'll sit and you know monitor those that's it so all the things whatever building copying to the server and you know running it and giving some messages uh slack boots uh so on so like slack messages also you'll be getting like if the job is failed or something in between and job is running the status and all those things you can enable the slack hooks as well inside this uh uh cicd uh I think I'm going in a deeper way I think you all know what is cicd and then I believe you you have came to this whole video to learn about GitHub workflows and actions right so let's uh do one thing let's go and create a repository why repository uh because GitHub actions you know basically we have to write it down in a script called uh workflows and slash sorry GitHub slw workflows inside that whatever we have yl file GitHub automatically takes you know those actions okay so let's go to your GitHub and then create a new repository uh let let's name that as you know GitHub actions or something right okay so this I'll keep it as public add a read me file just create a repository great I got my repository done so let's go and you know copy this uh or else go to SSH if you have already enabled SSH now let's go to your uh one of the document folder or something where you have uh let's do one thing let's initialize okay let's let's initialize it here um get clone insert okay uh I'm inside this and I'm going to open that into a code okay Visual Studio code let's minimize everything you can install the extensions from here if you want uh the extensions are you know very much uh good for coding and it will speed up your things okay you can go and install all git extensions if you want to great so okay let's do one thing let's check the git status we have nothing it's everything is cleaned Okay so now we'll create one folder called U let's create a folder called GitHub and then inside that another folder called workflows right then now whatever you'll create inside this perlow okay you have to create yaml files inside this let's uh name that yaml file has yellow world right so now uh you have uh successfully uh like you know create one file which will be uh made that as an actions you'll be seeing inside actions okay whenever you commit it now so we'll see whatever the commit actions will be U so you have this whole deployment things aure deployment AWS deployment you know like Cloud jke terraform uh deploy Alibaba cloud or something so you have multiple uh GitHub actions here if you want to come and you know check the uh continuous integration or deployment you can just check check what uh suits you and you know you can configure directly javascripts okay so we'll come to that next as of now I have I don't have any actions inside this uh uh GitHub actions repository so that's why I'm not able to see any actions now once you add this.ub and you know workflows it will automatically starts you know committing or deployment okay so let's see one thing first of all uh first header will come as you know name this name whatever you specify right uh that will be name of your uh deployment okay what or else we can say actions when you come to this action you'll be seeing one of the actions or workflow is getting done so that workflow name will be whatever you specify it here okay so I'll specify that as work you know name as you know hello world see/ C just for an example next will be uh another called as you know on so this is something uh uh the actions which will be doing when you when you push it okay uh when you push that into a branches let's say uh mean okay your your your branch name should be here okay let's say mean right if you have another Branch you can specify that that as in another Branch so it will be this should be in an array format so in if you have this document uh uh documentation like yaml or other other kind of documents like I have done in yaml XML I have I haven't worked on but yaml file whenever you are specifying that as a list or you know an array you'll be specifying that is in Array format format like you know by adding one SL one hyphen in front of that so that will be taken that as you know array okay so I have added one you want to format that by using you know alt shift F so this will be formatted so for this you can use prettier uh is again it's an extension you can install it from here okay great so now next will be let's say if you want to uh create a job what job you have to build it and then you have to Echo hello world okay that's my aim and that's my uh goal to you know do this whole uh first video on the actions I'm going to do that now so which is something called jobs and uh uh don't worry in future we'll be doing you know huge things like building the whole packaging and deploying it into server or something okay so job will be built runs on so this is very important okay if you want Linux you can do the Linux one like I mean uh if you want s to you can do sent to I usually prefer two okay once you have built uh like you know runs on UB to latest what we have to do we have to specify the steps to perform okay these are the main things here which whatever you specify it here right in whatever steps or something called as you know we have uh multiple steps like multiple uh jobs to do for the GitHub actions so we'll be specifying that as you know separate separate array Or List kind of structure which is something one name one name right and one uh users okay will come you know we have different things as well here but I'm I'm going to keep it keep it as short as possible so that it will be easy for you guys so one one is the name and another one is users okay and another one is like we have another run also inside this itself but I'm I'm not going to use run on the top I'm going to use it here so name again and then another one will be uh like what uh what we have to specify it here like Lear let's say run okay so now uh First Step what I have to do is whenever you commit uh the new changes inside your git I have to check it out like check out to the new Branch sorry check out to the new changes so for that check out I'm going to make you can name your name whatever you want here but I'm going to keep it specific uh repo okay or repository whatever check out repo then actions will be these are the actions which will be taken from know GitHub actions it this this should be uh specified correctly okay actions SL checkout at the V2 correct so this is something uh basic like uh until here we have specified for everything if you want to be continuous integrated like when whenever you commit or you know whenever you push the new changes in inside your get branch that should be taken as you know the latest and run it out so you have have to specify this steps this is the main step okay and this main branches like whatever the branch you have to run so now this two things you have to keep in mind this will be you know constraint for all but this Branch name will be changed but everything will be same so now let's uh go and you know create another step the step will be like you know print message okay whatever messages you want uh let's say hello world for everybody they usually use this itself okay so you can do another one here which is something uh can do like you know if you have multiple commands here right like Linux command or something you can do uh this uh pipe symbol or you know single line kind of a symbol it will be about to your Enter key and then you can do whatever actions you want here okay so whatever new commands you have uh as of now I have only one so I have I would have you know uh do it like this as well but let's keep at keep it as you you know um uh for the huge things next so let's say like Echo hello this is okay so this is done now so let's do one thing go to uh GitHub and if you see here we have one one of the changes uh which I haven't uh committed so let's commit this changes you can use this add option here for adding it into stat but I'm I'm going to use uh get add or else get status first so it will show this one of the GitHub actions I haven't added so let's do add this okay get add insert so this will be gone into a stage changes okay so if you see it's already added when you do again get status it will say like you know staged but I haven't uh uh but haven't you know committed you can do unstaged also like you know restore again or else you can just go here and you know press this tiny minus symbol which is unstaged so if you want it will be come back to the you know whatever the changes are so let's do commit again hyphen message add a message saying uh first CI and CD right let's do one thing like this and then uh whenever okay uh let's come [Music] here okay so let's let's uh let let us check here now every you every developer used to know this whenever you're working with the grid G banches which is shared with the different developers and uh you have this whole uh repository uh cloned inside your inside your local to commit something uh before you push right you have to do G pull make sure this okay why because you don't know when you when another developer has you know pushed some changes or your branch it it won't be in a proper line so what you have to do you have to uh uh what we say for that upstream or else you know you can just do a rebase your branch whatever you have current local branch either do that otherwise you know just do a get commit and then get Kit pull and then get push okay so that everything is in on the same line now when you get push uh so your changes will be gone to your uh GitHub and the actions will be starts uh continuously like instantly if you want to say so you can see a tiny uh check here which is something called you know one is skewed let's go here otherwise you can just go to actions as well let's go to actions see the first what I said like you know these are the steps right okay so the this is sorry this is the commit right right so this commit ID will be the name and your actions will be here hello world cicd what I told you the same thing if you go to your file uh let's say here I told you this name will be your actions and uh whatever you specify steps here right those will be your jobs so now let's do one thing um let's go inside this and check how our job whatever we specified the steps and you know uh whatever we specified the steps how it was running so on so so first thing what we did is we have to build it right so what we did we build okay so build is here okay and then let's build is here now specifying all the steps okay so set up a job set up a job is kind of you know whatever you are running here we have to take a main branch it took a main branch and you know it started workflow in the build okay uh so this is something called as a GitHub it's taking everything into an image this is a called as you know check out runner image Runner image in the sense UB to okay whatever you specified UB to latest okay so now if you see get up permission this everything you know it will be done in a background so you don't have to worry on that okay so next it will be downloading the actions what I specified you like you know actions SL check code at the V2 right these are the actions which will be taken from the GitHub so that is also done now let's do one thing uh let's check the check report okay now let's see the steps which is steps are something called as you know run actions uh check out we do okay it's syncing to my actions now again this repository getting the info from this and what it's doing it's setting up all or so on so so on so so on so everything is done so second name is something called prints print message let's see whether we have yeah we have this print message what it does it's running this hello Echo okay it's echoed okay the job has been done what is that so the job run and you know it gave the output called as hello world this is a sample cicd so this is done then it's something called you know post check out report and then complete the job cleaning up orun okay something is this everything is done let's go back to our thing and see done right so this is how uh the workflows are done okay guys that's it for this video I hope uh all you guys got to know how we can run samples sample cicd or we can say actions GitHub actions and workflows right so in this in the next video we will be seeing how we can connect to AWS CLI using clis you know and build your project if you want to if you have any other you know doubts and if you want any other topic to be created just let me know in the comments down and please subscribe to my channel like and share okay thank you so much bye-bye
Info
Channel: Mohammed Yaseen
Views: 172
Rating: undefined out of 5
Keywords: #GitHubActions, #CI_CD, #DevOps, #WorkflowAutomation, #CodePipeline, #ContinuousIntegration, #GitHubWorkflow, #SoftwareDevelopment, #TechTutorial, #CodeQuality, #AutomationTools, #ProgrammingTips, #VersionControl, #HelloWorldProgram, #BuildAutomation
Id: g4utnkROlgA
Channel Id: undefined
Length: 16min 42sec (1002 seconds)
Published: Sat Jan 20 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.