github workflow_dispatch

x·2023년 12월 1일
0

github

목록 보기
3/4

push하면 배포되도록 했는데 버튼을 만들고 싶어졌다

테스트로 feature 브랜치에 workflow_dispatch를 설정했는데 아무리 해도 버튼이 안나타났다.

default branch에만 적용할 수 있었다.
To trigger the workflow_dispatch event, your workflow must be in the default branch.

default branch 변경하는 방법
github repository -> Settings -> General -> Default branch -> <- -> 버튼 클릭

.github/workflows/cicd.yml

name: CICD
on:
  workflow_dispatch:
    branches:
      - release
    inputs:
      environment:
        description: 'Environment to run'
        type: environment
        required: true

jobs:
  build:
    environment: production
    runs-on: ubuntu-latest
    if: "${{ github.event.inputs.environment == 'production' }}"  # 특정 환경에만 배포되도록 설정하는 방법

    steps:
      - name: Checkout
        uses: actions/checkout@v3

env가 production이 아니면 skip됨

0개의 댓글