CI/CD with GitHub Actions
Demo Creator
@seed-creator · muallif
The Basic Workflow
A GitHub Actions workflow is a YAML file in .github/workflows/. It defines triggers (on: push, pull_request), jobs, and steps. Each step can run a shell command or call a community action.
CI without a fast feedback loop is barely better than no CI. Keep your total pipeline under five minutes or engineers start skipping it.
Caching Dependencies
Use actions/cache to restore node_modules between runs. Hash the lock file as the cache key so the cache invalidates exactly when dependencies change.
Split long pipelines into parallel jobs using needs: to sequence only the steps that truly depend on each other. Parallelism is free on GitHub-hosted runners.
Secrets and Environment Variables
Store secrets in GitHub repository settings, not in workflow files. Reference them with ${{ secrets.MY_SECRET }}. Secrets are masked in logs automatically.
name: CIon: [push, pull_request]jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: { node-version: '24' } - run: npm ci - run: npm test
Pin to a major version tag so you get security patches without breaking on minor API changes.
0 ta izoh
Tizimga kiring izoh qoldirish uchun.