Skip to content

Commit

Permalink
워크플로 트리깅 방식 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
waterfogSW committed Sep 21, 2024
1 parent ba1ef3f commit 233792a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/cd-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
name: Continuous Deployment to Dev

on:
repository_dispatch:
types: [trigger-cd]
workflow_dispatch:
inputs:
version:
description: 'Version to deploy (e.g., v1.2.3)'
required: true
type: string
push:
branches:
- main

env:
AWS_REGION: ap-northeast-2
Expand Down Expand Up @@ -39,10 +38,13 @@ jobs:
- name: Determine version to deploy
id: determine-version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
echo "VERSION=${{ github.event.client_payload.version }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "VERSION=latest" >> $GITHUB_OUTPUT
echo "Error: Unexpected event type"
exit 1
fi
- name: Check if image exists in ECR
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,13 @@ jobs:
git config user.email [email protected]
git tag ${{ steps.generate-version.outputs.version }}
git push origin ${{ steps.generate-version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}

- name: Trigger CD (DEV) Workflow
if: success()
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: trigger-cd
client-payload: '{"version": "${{ steps.generate-version.outputs.version }}"}'

0 comments on commit 233792a

Please sign in to comment.