Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

워크플로 트리깅 방식 수정 #13

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}"}'