CI/CD doesn’t have to be complicated. Here is a working pipeline in 5 minutes.
GitHub Actions — Basic Workflow¶
CI/CD Pipeline in 5 Minutes¶
name: CI on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: { node-version: 20 } - run: npm ci - run: npm test - run: npm run build
Docker Build + Push¶
build: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/build-push-action@v5 with: push: true tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
Deploy¶
deploy: needs: build if: github.ref == ‘refs/heads/main’ runs-on: ubuntu-latest steps: - run: kubectl set image deployment/app app=ghcr.io/$REPO:$SHA
Secrets¶
Settings → Secrets → New repository secret¶
Usage: ${{ secrets.KUBE_CONFIG }}¶
Caching¶
- uses: actions/cache@v4 with: path: ~/.npm key: ${{ runner.os }}-npm-${{ hashFiles(‘package-lock.json’) }}
That’s It¶
5 files, 5 minutes. Push → test → build → deploy. Extend gradually.