github action

22·2024년 7월 21일

CD

목록 보기
1/1

name

name: learn-github-actions

-> Actions 탭에 나타날 이름이다. (optional)

run-name

run-name: ${{ github.actor }} is learning GitHub Actions

-> Actions 탭을 클릭하면 나오는 워크플로 실행 목록에 표시되는 이름 (optional)

on

on: [push]

-> 워크 플로우에 대한 트리거를 지정한다. push, branch 등 여러 이벤트로 트리거할 수 있다.

  • cron 을 통해 스케줄링할 수 도 있다.
  • input 내용을 받을 수 있다.
on:
  workflow_dispatch:
    inputs:
      build_id:
        required: true
        type: string
      deploy_target:
        required: true
        type: string
      perform_deploy:
        required: true
        type: boolean

jobs:
  deploy:
    runs-on: ubuntu-latest
    if: ${{ inputs.perform_deploy }}
    steps:
      - name: Deploy build to target
        run: echo "Deploying build:${{ inputs.build_id }} to target:${{ inputs.deploy_target }}"

=> 이 예제에서 워크플로우는 'workflow_dispatch' 이벤트에 의해서 트리거 된다. 워크플로우에 전달된 build_id, deployt_target, perform_deploy 의 입력값을 가져오기 위해 input 을 사용한다.

permissions

REF

https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions#understanding-the-workflow-file
https://docs.github.com/en/actions/learn-github-actions/contexts#example-contents-of-the-inputs-context

0개의 댓글