92 words
1 minute
GitHub Actions: Automate Your Workflow
What Are GitHub Actions?
GitHub Actions is a CI/CD platform built directly into GitHub. It lets you automate builds, tests, and deployments triggered by events in your repository.
Your First Workflow
Create .github/workflows/ci.yml:
name: CI
on: push: branches: [main] pull_request: branches: [main]
jobs: test: runs-on: ubuntu-latest
steps: - uses: actions/checkout@v4
- uses: actions/setup-node@v4 with: node-version: 20 cache: 'npm'
- run: npm ci - run: npm test - run: npm run buildMatrix Builds
Test across multiple versions simultaneously:
jobs: test: runs-on: ubuntu-latest strategy: matrix: node-version: [18, 20, 22] os: [ubuntu-latest, macos-latest]
steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - run: npm ci && npm testCaching Dependencies
Speed up workflows by caching dependencies:
- uses: actions/cache@v4 with: path: ~/.pnpm-store key: pnpm-${{ hashFiles('pnpm-lock.yaml') }} restore-keys: pnpm-Deploy to Vercel on Push
name: Deploy
on: push: branches: [main]
jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: amondnet/vercel-action@v25 with: vercel-token: ${{ secrets.VERCEL_TOKEN }} vercel-org-id: ${{ secrets.ORG_ID }} vercel-project-id: ${{ secrets.PROJECT_ID }} vercel-args: '--prod'Useful Patterns
Run only when specific files change
on: push: paths: - 'src/**' - 'package.json'Manual triggers
on: workflow_dispatch: inputs: environment: description: 'Target environment' required: true default: 'staging' type: choice options: - staging - productionReusable workflows
on: workflow_call: inputs: node-version: required: true type: string
jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: ${{ inputs.node-version }} - run: npm ci && npm testGitHub Actions eliminates the need for external CI services. With the generous free tier (2,000 minutes/month for private repos), there’s no reason not to automate your workflow.
Share
If this article helped you, please share it with others!
GitHub Actions: Automate Your Workflow
https://blog.levifree.com/posts/github-actions-automate-workflow/ Some information may be outdated
Related Posts Smart
1
Docker for Beginners: Containerize Everything
DevOps Learn the fundamentals of Docker — from images and containers to Dockerfiles and docker-compose. A practical guide to containerizing your applications.
2
Nginx Reverse Proxy: The Complete Setup Guide
DevOps Configure Nginx as a reverse proxy with SSL, load balancing, caching, and security headers. A production-ready setup guide.
3
SSH Key Management: A Complete Guide
Security Everything you need to know about SSH keys — generating, managing, and using them securely for server access and Git authentication.
4
Deploying Apps with Vercel: Beyond the Basics
DevOps Go beyond basic deployments with Vercel — custom domains, environment variables, serverless functions, edge middleware, and monorepo setups.
5
A Practical Guide to TypeScript Generics
Programming Demystifying TypeScript generics with real-world examples. Learn how to write flexible, type-safe code that scales.
Random Posts Random
1
A Practical Guide to TypeScript Generics
Programming 2026-07-01
2
Tailwind CSS: From Skeptic to Convert
Web Dev 2026-06-07
3
Introduction to WebSockets: Real-Time Communication
Web Dev 2026-05-28
4
Deploying Apps with Vercel: Beyond the Basics
DevOps 2026-05-20
5
Web Security Essentials Every Developer Should Know
Security 2026-06-16





