CI/CD with GitHub Actions — Automate Your Deployments
Set up automated testing and deployment that runs every time you push code:
Sample .github/workflows/deploy.yml:
```yaml
name: Deploy to Production
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm test
- name: Build App
run: npm run build
- name: Deploy to Firebase
run: npx firebase-tools deploy --only hosting --token ${{ secrets.FIREBASE_TOKEN }}
`
Manage from CLI:
```cmd
gh workflow list # List all workflows
gh run list # Recent runs
gh run watch # Watch current run live
`
Push to main → tests run → deploys automatically. This is professional DevOps! 🚀
