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

feat: 젠킨스 to 깃헙액션 #430

Merged
merged 4 commits into from
Jun 29, 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
39 changes: 39 additions & 0 deletions .github/workflows/cd-dev-admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Mash-Up Admin Dev CD

on:
workflow_dispatch:
inputs:
tag:
description: '어드민 개발환경에 배포할 서비스 버전을 입력합니다.'
required: true

jobs:
trigger:
name: 개발 환경 ${{ inputs.tag }} 배포한다
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Custom Deployment Task
env:
TAG: ${{ inputs.tag }}
run: |
echo "Image Name: $IMAGE_NAME"
echo "Tag: $TAG"

- name: Excuting remote ssh commands
uses: appleboy/ssh-action@v1.0.3
env:
TAG: ${{ inputs.tag }}
with:
host: ${{ secrets.REMOTE_IP }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_PRIVATE_KEY }}
envs: TAG
script: |
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 321148231533.dkr.ecr.ap-northeast-2.amazonaws.com
cd /home/ec2-user/mashup-server/docker/deploy/admin/dev
sh ./deploy-admin.sh $TAG
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어떤건 TAG가 없는데 어떤 차인가요

Copy link
Collaborator Author

@hocaron hocaron Jun 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금은 없지만, dev 나중에 develop 에 머지되어야지만 develop 으로 태그만들어지는 방식외에도 별도의 브렌치에서 태그 만드는 방식으로 가려면 스크립트에 태그를 추가하려고 넣어줬습니다!

현재는 태그 넣어도 develop 으로만 되기는 합니당~! sh, docer-compose 수정 필요합니다.

prod 는 master 에 머지되어야지만 태그 만들어지는 방식으로만 현상 유지할 것 같아서, 태그 없애놓은 건데 덜 지웠네요! prod 는 다 지워놓을게욧!

39 changes: 39 additions & 0 deletions .github/workflows/cd-dev-member.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Mash-Up Member Dev CD

on:
workflow_dispatch:
inputs:
tag:
description: '멤버 개발환경에 배포할 서비스 버전을 입력합니다.'
required: true

jobs:
trigger:
name: 개발 환경 ${{ inputs.tag }} 배포한다
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Custom Deployment Task
env:
TAG: ${{ inputs.tag }}
run: |
echo "Image Name: $IMAGE_NAME"
echo "Tag: $TAG"

- name: Excuting remote ssh commands
uses: appleboy/ssh-action@v1.0.3
env:
TAG: ${{ inputs.tag }}
with:
host: ${{ secrets.REMOTE_IP }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_PRIVATE_KEY }}
envs: TAG
script: |
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 321148231533.dkr.ecr.ap-northeast-2.amazonaws.com
cd /home/ec2-user/mashup-server/docker/deploy/member/dev
sh ./deploy-member.sh $TAG
39 changes: 39 additions & 0 deletions .github/workflows/cd-dev-recruit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Mash-Up Recruit Dev CD

on:
workflow_dispatch:
inputs:
tag:
description: '리쿠르트 개발환경에 배포할 서비스 버전을 입력합니다.'
required: true

jobs:
trigger:
name: 개발 환경 ${{ inputs.tag }} 배포한다
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Custom Deployment Task
env:
TAG: ${{ inputs.tag }}
run: |
echo "Image Name: $IMAGE_NAME"
echo "Tag: $TAG"

- name: Excuting remote ssh commands
uses: appleboy/ssh-action@v1.0.3
env:
TAG: ${{ inputs.tag }}
with:
host: ${{ secrets.REMOTE_IP }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_PRIVATE_KEY }}
envs: TAG
script: |
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 321148231533.dkr.ecr.ap-northeast-2.amazonaws.com
cd /home/ec2-user/mashup-server/docker/deploy/recruit/dev
sh ./deploy-recruit.sh
37 changes: 37 additions & 0 deletions .github/workflows/cd-prod-admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Mash-Up Admin Real CD

on:
workflow_dispatch:

jobs:
trigger:
name: 운영 환경 production 배포한다
runs-on: ubuntu-latest
steps:
- name: Check if actor is admin
id: check-admin
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
user_login=${{ github.actor }}
repo=${{ github.repository }}
response=$(gh api repos/$repo/collaborators/$user_login/permission -q .permission)

if [[ "$response" != "admin" ]]; then
echo "이 워크플로우는 관리자만 실행할 수 있습니다."
exit 1
fi

- name: Excuting remote ssh commands
uses: appleboy/ssh-action@v1.0.3
env:
TAG: ${{ inputs.tag }}
with:
host: ${{ secrets.REMOTE_IP }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_PRIVATE_KEY }}
envs: TAG
script: |
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 321148231533.dkr.ecr.ap-northeast-2.amazonaws.com
cd /home/ec2-user/mashup-server/docker/deploy/admin/prod
sh ./deploy-admin.sh
37 changes: 37 additions & 0 deletions .github/workflows/cd-prod-member.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Mash-Up Member Real CD

on:
workflow_dispatch:

jobs:
trigger:
name: 운영 환경 production 배포한다
runs-on: ubuntu-latest
steps:
- name: Check if actor is admin
id: check-admin
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
user_login=${{ github.actor }}
repo=${{ github.repository }}
response=$(gh api repos/$repo/collaborators/$user_login/permission -q .permission)

if [[ "$response" != "admin" ]]; then
echo "이 워크플로우는 관리자만 실행할 수 있습니다."
exit 1
fi

- name: Excuting remote ssh commands
uses: appleboy/ssh-action@v1.0.3
env:
TAG: ${{ inputs.tag }}
with:
host: ${{ secrets.REMOTE_IP }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_PRIVATE_KEY }}
envs: TAG
script: |
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 321148231533.dkr.ecr.ap-northeast-2.amazonaws.com
cd /home/ec2-user/mashup-server/docker/deploy/member/prod
sh ./deploy-member.sh
37 changes: 37 additions & 0 deletions .github/workflows/cd-prod-recruit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Mash-Up Recruit Real CD

on:
workflow_dispatch:

jobs:
trigger:
name: 운영 환경 production 배포한다
runs-on: ubuntu-latest
steps:
- name: Check if actor is admin
id: check-admin
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
user_login=${{ github.actor }}
repo=${{ github.repository }}
response=$(gh api repos/$repo/collaborators/$user_login/permission -q .permission)

if [[ "$response" != "admin" ]]; then
echo "이 워크플로우는 관리자만 실행할 수 있습니다."
exit 1
fi

- name: Excuting remote ssh commands
uses: appleboy/ssh-action@v1.0.3
env:
TAG: ${{ inputs.tag }}
with:
host: ${{ secrets.REMOTE_IP }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_PRIVATE_KEY }}
envs: TAG
script: |
aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin 321148231533.dkr.ecr.ap-northeast-2.amazonaws.com
cd /home/ec2-user/mashup-server/docker/deploy/recruit/prod
sh ./deploy-recruit.sh
Loading