Information/Github

[Github Actions] Github Actions Workflow Quick Start

페트론 2022. 1. 20. 00:03

Goal of a Post

  • 예제를 통해 Github Actions Workflow를 구성하고, CI/CD를 구현.
  • 이를 Github 웹을 통해 실습.

Reference

Github의 공식 튜토리얼을 참고하여 조금 더 자세히 내용을 추가함.

 

https://docs.github.com/en/actions/quickstart

 

Quickstart for GitHub Actions - GitHub Docs

Introduction You only need a GitHub repository to create and run a GitHub Actions workflow. In this guide, you'll add a workflow that demonstrates some of the essential features of GitHub Actions. The following example shows you how GitHub Actions jobs can

docs.github.com

 

Practice

1. Creating Repository

"Repositories" 메뉴를 선택하고 "New" 버튼을 눌러 레포지토리를 생성함.

 

레포지토리명은 자유롭게 명명하면 됨. 해당 실습에서는 "github_workflows_test" 라고 명명.

README file을 추가하고 "Create repository" 선택.

 

2. Creating workflow

레포지토리가 생성되면 우상단의 "Add file" 버튼을 선택하고 "Create new file" 선택.

 

하기 내용과 같이 수정.

 

File Name

 

.github/workflows/github-actions-demo.yml

 

Workflow

name: GitHub Actions Demo
on: [push]
jobs:
  Explore-GitHub-Actions:
    runs-on: ubuntu-latest
    steps:
      - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
      - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
      - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
      - name: Check out repository code
        uses: actions/checkout@v2
      - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
      - run: echo "🖥️ The workflow is now ready to test your code on the runner."
      - name: List files in the repository
        run: |
          ls ${{ github.workspace }}
      - run: echo "🍏 This job's status is ${{ job.status }}."

 

이후 "Create a new branch for this commit and start a pull request"를 선택하고, "Propose new file" 선택.

 

"Create pull request" 선택.

"Merge pull request" 선택.

"Confirm merge" 선택.

 

Pull request 성공 메시지 확인 후, 상단의 "Actions" 메뉴를 선택.

 

3. Checking workflow

목록에서 생성된 워크플로우를 선택.

 

"Explore-Github-Actions"를 선택.

 

해당 부분에서 Workflow의 log를 확인할 수 있음.

 

좌측의 토글버튼을 클릭하면 상세내용을 확인할 수 있음.

반응형