How to bring Github Actions to your project
A Brief Description of GitHub Actions
Built-in CI/CD for GitHub.

Introduction
In the past, implementing CI might involve lengthy discussions (or even arguments) within the team about the best CI solutions, such as CircleCI, DroneCI, Jenkins, and others. However, as long as the code is hosted on GitHub, integrating CI becomes a breeze with GitHub Actions. While it may not be a universal solution or a silver bullet, I find it quite straightforward for typical scenarios like running tests or even pushing and deploying code. Below, I will introduce how to get started.
How to Get Started
Simply add a workflow descriptor file named .github/workflows/your-workflow.yml in the root directory of your code.
Related Resources
Before diving in, it might be quicker to share a few document links to get you started. However, if you prefer to read through the documentation first, here are some resources:
- Overview: https://github.com/features/actions
- Documentation: https://help.github.com/en/actions
- GitHub Actions Marketplace: https://github.com/marketplace?type=actions
How to Add GitHub Actions to Your Project
A workflow consists of several jobs, and each job is made up of multiple steps. A step can be a GitHub Action, running a command, and so on. Here’s a basic example:
name: your-name
# Refer to the documentation for available events
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
on:
push:
branches:
- master
paths-ignore: # Sometimes, you may not want to trigger GitHub Actions just by changing a file; you can use this ignore
- 'docs/**'
- 'README.md'
- 'LICENSE'
- 'CONTRIBUTING.md'
branches-ignore:
- 'xxxx'
tags-ignore:
- 'v1.*'
env: # Set environment variables
PROJECT_ID: ${{ secrets.PROJECT_ID }}
RUN_REGION: asia-northeast2
SERVICE_ACCOUNT: ${{ secrets.SERVICE_ACCOUNT }}
jobs:
setup-build-and-deploy:
name: Setup gcloud and deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: '290.0.1'
project_id: ${{ secrets.PROJECT_ID }}
service_account_email: ${{ secrets.SA_EMAIL }}
server_account_key: ${{ secrets.SA_KEY }}
export_default_credentials: true
- name: Deploy
run: |-
echo $SERVICE_ACCOUNT > /tmp/key.json && \
gcloud auth activate-service-account --key-file /tmp/key.json && \
gcloud app deploy --project "$PROJECT_ID"
For more advanced scenarios, if you want to dynamically evaluate conditions at runtime, you can write it like this: https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
env:
my_env_var: ${{ ALPHA ? 'A' : 'B' }}
When running, GitHub Actions automatically provides some context for you.
Environment Variables
Environment variables can be set in the secrets of your project. By default, only collaborators can see them, and others cannot access the secrets via Pull Requests in GitHub Actions.

This article serves as a quick reference on how to use GitHub Actions; next time you set it up, it should be much faster!
Related Posts
- When Measurement Becomes the Goal: From Window Tax to PR Counts I once wrote a small tool to count how many PRs I had contributed in a quarter, how many reviews I had left, and how many tickets I had closed, hoping to use the numbers to prove my output to my manager. My manager simply said performance is not judged by output alone. Only years later did I understand—when measurement becomes the goal, it is no longer a good measure. From Britain’s window tax and the Hanoi rat bounty to evaluating developers by PR count today, the mechanism is exactly the same.
- Using Cloudflare Images for Image Storage and Transformation Putting an image on a web page is the easiest thing in frontend. But doing it properly — resizing, generating every format, holding up under traffic — turns into a whole solution of its own. I ended up handing all of it to Cloudflare Images and keeping just one original.
- Stop Using Access Keys Already Access Keys are an easily overlooked security risk on AWS. Use OIDC with IAM Roles so GitHub Actions can securely access AWS resources without any secrets.
- Database Primary Keys: AUTO_INCREMENT, UUID, and UUIDv7 Backend developers often have to decide on a primary key: auto increment or UUID? What about collisions? How much faster is UUIDv7 compared with created_at + index? After benchmarking 20 million rows and looking at the design trade-offs, this post gives you the answer.