Language:

Search

Microsoft Azure – Deploying Web Applications Using GitHub Actions

  • Share this:

In this article, we will learn, how to deploy to your web app using GitHub Actions. GitHub Action is a workflow automation utility that has CICD built right in. This means a GitHub user can trigger a workflow run if there’s a new commit, a new pull request, or a new branch is created.

Below is a web app, go into the Deployment Center on the left. And there, you will have options for Azure Repos, GitHub, and Bitbucket.

 

1.PNG

Now, select GitHub and hit continue. On the screen, you will have a new option for GitHub Actions, so select that.

2.PNG

And now on the next screen, select your repository. Select your username. And then your Spring application that you are going to deploy. It could be any branch, but for example, if you have chosen the master branch. Then, use Java 8 to continue the process. Since you are deploying a Spring Boot application, choose Java SE. If you were deploying a Tomcat application, you could choose one of the Tomcat versions.

3.PNG

 

So, on the last screen, you have a summary of your selections, so you could go back and edit. And at the bottom, You are looking at a preview of the workflow file that will be committed into your repository. So if you take a quick look, this will run anytime that there’s a push on the master branch. This will check out the master branch of your repo, set up your Java version to Java 8. It’ll build you a Spring app using Maven. And then finally, using the deployment action, it will grab that jar file and then deploy it onto your web app.

4.PNG

So when you click to finish this will start the process to commit it into your repository. Then go into your repo using this link. So, there’s a new directory in your GitHub repo, .github/workflows. So, this is where all of your workflows would be. And if you take a look at the file, it matches the one that was shown in the preview just a minute ago. 

So, what you will do now is come up to the top toolbar, select Actions. And this shows you all of your previous workflow runs and on the left-hand side, it shows you all of your different workflow files.

5.PNG

Now, select one of these workflow files right here. And you can see that that deployment action is running right now.

 

So if you click that and come over to build and deploy on the left, where you can find all of your different steps of that workflow. And you can even search your logs. So here, we’re looking at the progress of the maven build. And then this is the output of the web apps deploy action. So if you search through some query terms here, you will see that shows up just fine. 

6.PNG

So, moving to the portal. You can see in the dashboard that’s reflected here that the success of the workflow is right there and it’s running.

7.PNG

Let’s browse the application. It’s your Spring Boot app running on your web app and you deployed it with GitHub Actions. 

8.PNG

 
Sushan Shrestha

Sushan Shrestha

Join me on a captivating journey as I unravel the complexities of maintaining digital infrastructures, troubleshooting labyrinthine networks, and safeguarding the virtual realms from the shadows. Together, we'll explore the challenges and where every click and command shapes the digital destiny.