Published on

Github CI/CD Notlari

Authors
  • avatar
    Name
    Orkun Gunay
    Twitter

Github Actions bilesenleri

Actions ile asagidaki ornek workflow'lari olusturabiliyoruz:

  • run tests whenever you push a change to your repository
  • deploy merged pull requests to production.

Workflows

workflow bir veya daha cok isi otomatize etme prosesidir. (jenkins'teki pipeline) Repoda .github/workflows dizininde yaml dosyasi formatinda tutulur. Bir repo'nun bir cok workflow'u olabilir; mesela

  • PR'larin build ve test edilmesi
  • release cikildiginda uygulamanin deploy edilmesi
  • issue acildiginda label eklenmesi

Triggers

  • workflow'un oldugu repo'da bir event olustugunda
  • GitHub'in disindaki bir event'in event on GitHub'daki repository_dispatch event'ini tetiklemesiyle
  • Scheduled times
  • Manual

The following steps occur to trigger a workflow run:

  • An event occurs on your repository. The event has an associated commit SHA and Git ref.
  • GitHub searches the .github/workflows directory in the root of your repository for workflow files that are present in the associated commit SHA or Git ref of the event.
  • A workflow run is triggered for any workflows that have on: values that match the triggering event. Some events also require the workflow file to be present on the default branch of the repository in order to run. (event'tan kasit associated commit SHA and Git ref. olsa gerek. Branch'te workflow dizinini ariyor)

Each workflow run will use the version of the workflow that is present in the associated commit SHA or Git ref of the event. When a workflow runs, GitHub sets the GITHUB_SHA (commit SHA) and GITHUB_REF (Git ref) environment variables in the runner environment.

Ornek yaml ve aciklamalar

Greeting on variable day'de sadece run step'indeki env runner tarafindan dikkate alinir. Diger env'ler runner'a gonderilmez.

Using contexts to access variable values

Contexts workflow'da tanimlanan bilesenlerdeki bilgiye erisim yoludur. (runs, variables, runner environments, jobs, and steps)

runner'a gonderilmeyecek ama Github Actions'taki workflows'un bir parcasi olacak env. variables'i run step'inde tanimlamamalisin. bunun yerine contexts'i kullanmalisin.

Kaynaklar