Github action 문법들 - codingjwp/smartphone-project GitHub Wiki
Github Action
Gtihub Action은 워크플로우 파일 YAML 구문을 사용하며 확장자는 .yml, .yaml
이어야 합니다.
Github Action 워크플로우 구문
name
workflow 이름입니다.
repository의 Action 탭에서 이름으로 표시되면 name을 생략하는 경우 repository의 root를 기준으로 표시합니다.
name: CI/CD
run-name
Action 탭에 있는 workflow 실행 목록에 workflow 실행 이름을 표시합니다.
생략 시 이벤트 별 정보로 설정됩니다.
run-name: Build and Deploy
on
workflow를 실행할 수 있는 이벤트를 정의합니다.
특정 파일, 태그 또는 브랜치 변경에 대해서만 workflow가 실행되도록 제한할 수 있습니다.
# 한개의 이벤트 사용
on: push
# 여러개의 이벤트 사용
on: [push, fork]
# 필터 사용 일치한 분기에 푸시가 발생했을때 적용됩니다.
on:
push:
branches:
- main
- 'releases/**'
다른 경우 Using activity types, Using activity types and filters with multiple events 가 존재합니다.
permissions
GITHUB_TOKEN
에 부여된 기본 권한을 수정할 수 있습니다.
자세한 상황은 해당 사이트를 확인해주세요.
permissions:
actions: read|write|none
checks: read|write|none
contents: read|write|none
deployments: read|write|none
id-token: read|write|none
issues: read|write|none
discussions: read|write|none
packages: read|write|none
pages: read|write|none
pull-requests: read|write|none
repository-projects: read|write|none
security-events: read|write|none
statuses: read|write|none
jobs
workflow를 구성하는 주요 단위입니다.
workflow는 하나 이상의 jobs
로 구성되며, 각 job
은 workflow가 수행할 작업들을 나타냅니다