DEV Community

Cover image for Upload Node.Js Code to azure using CI/CD pipeline using github actions
Dhaval Upadhyay
Dhaval Upadhyay

Posted on • Edited on

Upload Node.Js Code to azure using CI/CD pipeline using github actions

Introduction

In today’s agile development environment, continuous integration and continuous deployment (CI/CD) pipelines are essential for streamlining the software delivery process. In this blog, I’ll guide you through setting up a CI/CD pipeline using GitHub Actions to deploy your Node.js application to Azure.

Prerequisites

Before we start, ensure you have the following:

Azure Account: If you don’t have one, sign up for a free Azure account.
Azure Web App: Create a Web App in the Azure portal to host your Node.js application.
GitHub Repository: Store your Node.js application code in a GitHub repository.
Node.js Application: A basic Node.js application to deploy.

Step 1: Create an Azure Web App

Login to Azure Portal: Go to the Azure Portal.

Here’s a draft blog post on deploying Node.js code to Azure using a CI/CD pipeline with GitHub Actions. Feel free to modify it to match your style and preferences.

Title: Node.js Deployment Using Azure CI/CD Pipeline

Introduction
In today’s agile development environment, continuous integration and continuous deployment (CI/CD) pipelines are essential for streamlining the software delivery process. In this blog, I’ll guide you through setting up a CI/CD pipeline using GitHub Actions to deploy your Node.js application to Azure.

Prerequisites
Before we start, ensure you have the following:

Azure Account: If you don’t have one, sign up for a free Azure account.
Azure Web App: Create a Web App in the Azure portal to host your Node.js application.
GitHub Repository: Store your Node.js application code in a GitHub repository.
Node.js Application: A basic Node.js application to deploy.

Step 1: Create an Azure Web App

Login to Azure Portal: Go to the Azure Portal.

Click on “Create a resource” and choose “Web App.”

Image description

Fill in the required details, including the resource group, app name, and runtime stack (choose Node.js).

Image description

Step 2: Set Up GitHub Actions for CI/CD

Create a .github/workflows Directory:

Go To Deployment center

Image description

Select Code Resource and select github

Image description

Now Select github accout , repo and branch you want to deploy

Now click on preview you can see .yaml file structre here

Image description

In your github directory, you can see .github/workflows directory.

Image description

Step 3: Commit and Push Changes

Once your workflow file is set up, commit and push it to the main branch of your repository.

The pipeline will trigger automatically on every push to the main branch.

GitHub Actions will build your Node.js application, run tests, and deploy it to Azure.

You can also check the deployment logs in the GitHub Actions tab of your repository.

Image description

Conclusion

In this blog, we walked through the process of setting up a CI/CD pipeline using GitHub Actions to deploy a Node.js application to Azure. This setup not only automates the deployment process but also ensures that your application is always up-to-date with the latest code changes.

By leveraging Azure’s scalability and GitHub’s seamless integration, you can easily maintain and deploy your Node.js applications, allowing you to focus more on building features and less on managing deployments.

You can check Simple deployment without pipeline here https://dev.to/dhaval_upadhyay_30f8292a8/uploading-your-first-nodejs-code-to-azure-a-step-by-step-guide-43k5

Top comments (2)

Collapse
 
dhaval_upadhyay_30f8292a8 profile image
Dhaval Upadhyay

please like . ccomment , share and follow for upcoming blogs

Collapse
 
dhaval_upadhyay_30f8292a8 profile image
Dhaval Upadhyay

You can check Simple deployment without pipeline here dev.to/dhaval_upadhyay_30f8292a8/u...