DEV Community

Cover image for ๐Ÿš€How to Create Your First GitHub Trigger & Connections in Google Cloud Build
Latchu@DevOps
Latchu@DevOps

Posted on

๐Ÿš€How to Create Your First GitHub Trigger & Connections in Google Cloud Build

Google Cloud Build makes it incredibly simple to automate your CI/CD pipeline. One of the most common setups is connecting GitHub โ†’ Cloud Build so that every commit automatically triggers a build.
If you're new to Cloud Build, follow this step-by-step guide to create your first trigger successfully.


๐Ÿ”— Step 1: Connect GitHub Repository to Cloud Build

  • Open Google Cloud Console โ†’ Search for Cloud Build.
  • Go to the Triggers section.
  • Click โ€œConnect Repositoryโ€.
  • Select your source provider: โ†’ GitHub (Cloud Build GitHub App)

1

  • Click Continue to Authenticate.

2

  • Youโ€™ll be redirected to GitHub to install the Cloud Build GitHub App.
  • After installation, return to Cloud Build.
  • Select the GitHub account and repository you want to connect.
  • Click Connect โ†’ Done.

Your GitHub repo is now officially linked with Google Cloud Build.


โš™๏ธ Step 2: Create Your First Cloud Build Trigger

  1. In Cloud Build โ†’ Go to Triggers โ†’ Create Trigger.

  2. Fill in the fields:

Basic Settings

  • Name: first-trigger
  • Region: global
  • Tags: dev_team

Event Type

  • Event: Push to a branch

3

Source Configuration

  • Source: Cloud Build Repositories
  • Repository type: 1st generation
  • Repository: Select your GitHub repo
  • Branch: ^main$ (This ensures the trigger runs only for main branch pushes)

4

Build Configuration

  • Configuration: Autodetected
  • Location: Repository (Cloud Build will search for your cloudbuild.yaml inside the repo)

Service Account

  • Select your Cloud Build service account
  • Click Create Trigger

Your first CI pipeline is now ready!


๐Ÿ“ Step 3: Commit Changes in GitHub

  1. Open your GitHub repository.

  2. Make a small change (add a print statement, update a README, etc.).

  3. Commit and push the changes.

This action will automatically trigger Cloud Build.


๐Ÿ“Š Step 4: View Build History & Logs

5

  1. Go to Cloud Build โ†’ History.

  2. Youโ€™ll see your recent builds.

  3. Click any build to open the Build Summary:

You can view:

  • Build logs
  • Execution details
  • Artifact outputs
  • Build duration & steps

6

7


๐Ÿ“ˆ Step 5: Monitor Overall Build Activity

Open the Cloud Build Dashboard to get a high-level view of:

  • Recent build status
  • Success/failure rate
  • Build durations
  • Trigger usage

8

This helps track the health of your CI pipeline easily.


๐ŸŽ‰ Final Thoughts

Youโ€™ve now successfully set up:

โœ” GitHub connected to Cloud Build
โœ” A working build trigger
โœ” Automated builds on every commit
โœ” Build logs and dashboard monitoring


๐ŸŒŸ Thanks for reading! If this post added value, a like โค๏ธ, follow, or share would encourage me to keep creating more content.


โ€” Latchu | Senior DevOps & Cloud Engineer

โ˜๏ธ AWS | GCP | โ˜ธ๏ธ Kubernetes | ๐Ÿ” Security | โšก Automation
๐Ÿ“Œ Sharing hands-on guides, best practices & real-world cloud solutions

Top comments (0)