Back to all posts
TechnologyGitHub Actions CI/CD pipeline

Setting Up a GitHub Actions CI/CD Pipeline

1. What you'll need

3 min readUpdated July 5, 2026AI-assisted

TechSilo

AI-assisted and human-curated

1. **What you'll need**

To set up a GitHub Actions CI/CD pipeline, you'll need a GitHub account, a repository with your project code, and Node.js (version 14 or higher) installed on your machine. You'll also need a basic understanding of YAML syntax, as GitHub Actions uses YAML files for configuration.

2. **Step 1: Create a new repository and initialize a Node.js project**

Create a new repository on GitHub and initialize a new Node.js project by running npm init in your terminal. This will create a package.json file in your project directory. Then, create a new directory for your project and navigate into it: mkdir myproject && cd myproject.

3. **Step 2: Create a GitHub Actions workflow file**

In your repository, create a new directory called .github/workflows and navigate into it: mkdir -p .github/workflows && cd .github/workflows. Create a new file called nodejs.yml with the following contents:

yml
name: Node.js CI

on:
  push:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v2
        with:
          node-version: '14'
      - name: Install dependencies
        run: npm install
      - name: Run tests
        run: npm test

This file defines a workflow that will run on every push to the main branch.

4. **Step 3: Configure the workflow to build and test your project**

In the nodejs.yml file, update the run commands to match your project's build and test scripts. For example, if your project uses npm run build to build and npm run test to test, update the file as follows:

yml
name: Node.js CI

on:
  push:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node.js
        uses: actions/setup-node@v2
        with:
          node-version: '14'
      - name: Install dependencies
        run: npm install
      - name: Build project
        run: npm run build
      - name: Run tests
        run: npm run test

5. **Step 4: Commit and push the workflow file**

Commit the nodejs.yml file and push it to your GitHub repository: git add . && git commit -m "Add GitHub Actions workflow" && git push origin main.

6. **Step 5: Verify the workflow is running**

Go to your GitHub repository and click on the Actions tab. You should see the workflow running. If it's not running, check that you've pushed the nodejs.yml file to the correct branch.

7. **Verify it works**

To verify that the workflow is working, make a change to your project code and push it to the main branch. The workflow should run automatically and display the results in the Actions tab.

8. **Common errors**

* Error: No workflow file found: Make sure you've created a nodejs.yml file in the correct location (.github/workflows) and that you've pushed it to the correct branch.

* Error: Node.js version not found: Make sure you've specified a valid Node.js version in the nodejs.yml file. You can check the available versions by running npm install node@latest and checking the output.

9. **Next steps**

Now that you've set up a GitHub Actions CI/CD pipeline, you can customize the workflow to fit your project's needs. You can add more steps to the workflow, such as deploying to a production environment or sending notifications. You can also use other GitHub Actions features, such as secrets to store sensitive information and environments to define different deployment environments.

Want to put this into practice?

Explore TechSilo's free developer tools for practical utilities you can use directly in your browser.

Try these free tools

Related blog posts