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

백엔드 Github Actions CD 파이프라인 구축 #34

Merged
merged 47 commits into from
May 24, 2024
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
dbfc559
deploy flow 작성
gidskql6671 May 24, 2024
658fb08
배포 스크립트 작성
gidskql6671 May 24, 2024
bff13d4
TEST
gidskql6671 May 24, 2024
4386215
TEST
gidskql6671 May 24, 2024
094112e
TEST
gidskql6671 May 24, 2024
f48e57d
TEST
gidskql6671 May 24, 2024
5b64e51
TEST
gidskql6671 May 24, 2024
a46dcb3
TEST
gidskql6671 May 24, 2024
8833cb1
TEST
gidskql6671 May 24, 2024
d865949
TEST
gidskql6671 May 24, 2024
1f5a6a6
TEST
gidskql6671 May 24, 2024
4a947dc
TEST
gidskql6671 May 24, 2024
4570b53
TEST
gidskql6671 May 24, 2024
f0330cc
TEST
gidskql6671 May 24, 2024
a534157
TEST
gidskql6671 May 24, 2024
0275f80
TEST
gidskql6671 May 24, 2024
17d680c
TEST
gidskql6671 May 24, 2024
94e222e
TEST
gidskql6671 May 24, 2024
1bb2460
TEST
gidskql6671 May 24, 2024
680b192
TEST
gidskql6671 May 24, 2024
d452824
TEST
gidskql6671 May 24, 2024
7904010
TEST
gidskql6671 May 24, 2024
30531cc
TEST
gidskql6671 May 24, 2024
85e7aca
TEST
gidskql6671 May 24, 2024
59505df
TEST
gidskql6671 May 24, 2024
73e27f0
TEST
gidskql6671 May 24, 2024
56483e7
TEST
gidskql6671 May 24, 2024
1b43ddd
TEST
gidskql6671 May 24, 2024
2cbae3a
TEST
gidskql6671 May 24, 2024
1e1a184
TEST
gidskql6671 May 24, 2024
d9732a6
TEST
gidskql6671 May 24, 2024
d198d73
TEST
gidskql6671 May 24, 2024
59e65ef
TEST
gidskql6671 May 24, 2024
7c3f3f3
TEST
gidskql6671 May 24, 2024
e745b05
TEST
gidskql6671 May 24, 2024
35e9d3d
TEST
gidskql6671 May 24, 2024
da9b549
TEST
gidskql6671 May 24, 2024
cf9eca0
TEST
gidskql6671 May 24, 2024
6cd6213
TEST
gidskql6671 May 24, 2024
1c2d8b4
TEST
gidskql6671 May 24, 2024
e258b04
TEST
gidskql6671 May 24, 2024
0bfa01f
TEST
gidskql6671 May 24, 2024
2860f4f
TEST
gidskql6671 May 24, 2024
d7267ca
TEST
gidskql6671 May 24, 2024
7b0ec6f
TEST
gidskql6671 May 24, 2024
138a206
TEST
gidskql6671 May 24, 2024
972406f
TEST
gidskql6671 May 24, 2024
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
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: 배포

on:
push:
branches: [main, deploy/33-BE_cd]
workflow_dispatch:

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]

- name: execute remote ssh
uses: appleboy/ssh-action@master
env:
REMOTE_SSH_PASSWORD: ${{ secrets.REMOTE_SSH_PASSWORD }}
with:
host: ${{ secrets.REMOTE_SSH_HOST }}
username: ${{ secrets.REMOTE_SSH_USERNAME }}
password: ${{ secrets.REMOTE_SSH_PASSWORD }}
port: ${{ secrets.REMOTE_SSH_PORT }}
envs: BRANCH_NAME, REMOTE_SSH_PASSWORD
script_stop: true
script: |
cd workspaces/1day1baek/back

git reset --hard HEAD

cur_git_branch=$(git branch --show-current)
if [ "$cur_git_branch" != "$BRANCH_NAME" ]; then
git switch main
fi
git pull origin main

server_process=$(ps -ef | grep OneDayOneBaek-0.0.1-SNAPSHOT.jar$ | grep java)
server_pid=(${server_process// / })
server_pid=${server_pid[1]}

if [ -n "$server_pid" ]; then
echo "existed server pid : $server_pid"

echo $REMOTE_SSH_PASSWORD | sudo -S kill -9 $server_pid
fi

./run_sandbox.sh
Loading