DevOps. GitHub Actions 워크플로우
들어가며 GitHub Actions는 저장소에서 발생한 이벤트를 기준으로 빌드, 테스트, 배포 같은 작업을 자동화한다. 자동화 과정은 .github/workflows 디렉토리의 YAML 파일로 정의한다. 처음 workflow를 작성할 때는 name, on, jobs, steps가 각각 무엇을 나타내는지부터 이해할 필요가 있다. 전체 구조 GitHub Actions의 실행 흐름은 다음과 같다. Event -> Workflow -> Job -> Runner -> Step 이 흐름을 YAML로 표현하면 다음과 같다. name: Build and Test run-name: Build triggered by @${{ github.actor }} on: push: branches: - main pull_request: branches: - main workflow_dispatch: jobs: build: runs-on: macos-latest steps: - uses: actions/checkout@v4 - name: Build run: echo "Build" test: needs: build runs-on: macos-latest steps: - uses: actions/checkout@v4 - name: Test run: echo "Test" name과 run-name name은 workflow 자체의 이름이다. GitHub 저장소의 Actions 탭에서 workflow를 구분할 때 사용한다. ...