/github-for-non-tech

How to trigger a deployment from GitHub?

Master GitHub deployments with our step-by-step guide. Learn to set up a repo, configure GitHub Actions, and trigger deploys automatically or via API.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to trigger a deployment from GitHub?

 

Step 1: Open or create a GitHub repository

 

Before you can trigger any deployment, you need a GitHub repository containing your project.

  • Sign in to GitHub and navigate to https://github.com/new to create a new repository.
  • Clone an existing repository locally using:
git clone https://github.com/your-username/your-repo.git
cd your-repo

 

Step 2: Initialize a local project and commit changes

 

If you’re starting from scratch, initialize a Git repo, add code, and push to GitHub.

  • Initialize Git and add files:
git init
echo "# MyProject" > README.md
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/your-username/your-repo.git
git push -u origin main

 

Step 3: Enable GitHub Actions for your repository

 

GitHub Actions provides CI/CD workflows. To deploy automatically, you’ll create a workflow file.

  • In your repository UI, go to the Actions tab.
  • Click New workflow, then choose set up a workflow yourself.
  • This creates a folder .github/workflows/ in your repo.

 

Step 4: Create a deployment workflow file

 

Inside .github/workflows/, create a file named deploy.yml.

name: Deploy Application

on:
push:
branches:
- main
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
    uses: actions/setup-node@v3
    with:
      node-version: '16'

- name: Install dependencies
    run: npm install

- name: Build project
    run: npm run build

- name: Deploy to server
    run: |
      echo "Deploying to production..."
      # insert your deploy commands here

 

Step 5: Commit and push the workflow

 

  • Stage and commit your workflow file:
git add .github/workflows/deploy.yml
git commit -m "Add deployment workflow"
git push origin main

 

Step 6: Automatic deployment on push

 

With the above configuration, every push to the main branch triggers the deploy job.

  • Make a change, commit, and push:
echo "console.log('hello')" >> index.js
git add index.js
git commit -m "Trigger deployment"
git push origin main
  • Go to the Actions tab to monitor the running workflow.

 

Step 7: Manual deployment trigger

 

You can trigger the workflow manually via the Actions tab or via GitHub REST API.

  • In the repo’s Actions tab, select Deploy Application and click Run workflow.
  • Choose branch, then click Run workflow.

 

Step 8: Trigger deployment via REST API

 

Use GitHub’s REST API to dispatch the workflow programmatically.

curl -X POST \\
  -H "Accept: application/vnd.github.v3+json" \\
  -H "Authorization: token YOUR_PERSONAL_ACCESS\_TOKEN" \\
  https://api.github.com/repos/your-username/your-repo/actions/workflows/deploy.yml/dispatches \\
  -d '{"ref":"main"}'
  • Replace YOUR_PERSONAL_ACCESS\_TOKEN with a token having repo and workflow scopes.

 

Step 9: Verify your deployment

 

After triggering, check the workflow logs and your production endpoint.

  • In Actions, view logs for each step.
  • Confirm your application is live by visiting its URL or checking server logs.

 

Step 10: Advanced trigger options

 

You can extend triggers in deploy.yml:

  • schedule for cron jobs:
on:
  schedule:
    - cron: '0 0 _ _ \*'  # midnight UTC daily
  • pull\_request to deploy preview builds:
on:
  pull\_request:
    types: [opened, synchronize]

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022