devops101 › Cheat sheet'ler › 🔁 GitHub Actions cheat sheet

🔁 GitHub Actions cheat sheet

Workflow iskeleti

name: ci on: [push, pull_request]Tetikleyiciler
on: push: branches: [main] paths: ["src/**"]Yola/dala göre
on: schedule: - cron: "0 3 * * *"Zamanlanmış
on: workflow_dispatchElle tetikle
jobs: test: runs-on: ubuntu-latestJob ve runner

Adımlar

- uses: actions/checkout@v4Kodu çek
- uses: actions/setup-node@v4 with: { node-version: 20, cache: npm }Node + cache
- run: npm ci && npm testKomut çalıştır
- uses: docker/build-push-action@v6 with: { push: true, tags: ghcr.io/ben/app:${{ github.sha }} }İmaj build/push
- uses: actions/upload-artifact@v4Artifact yükle

İleri

strategy: matrix: node: [18, 20]Matris
needs: [test]Sıra bağımlılığı
if: github.ref == 'refs/heads/main'Koşullu
env: TOKEN: ${{ secrets.TOKEN }}Secret kullan
permissions: contents: readToken yetkisini daralt
concurrency: group: ci-${{ github.ref }} cancel-in-progress: trueEskiyi iptal et
environment: productionOnaylı ortam
uses: org/repo/.github/workflows/dep.yml@v2Yeniden kullanılabilir workflow

Uygulamada aç ve alıştırmaları çöz →