-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.7 KB
/
leets-actions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: leets-actions
run-name: Running
on:
push:
branches:
- main
- 'releases/**'
env:
AWS_REGION: ap-northeast-2
AWS_S3_BUCKET: gitactionbucket
AWS_CODE_DEPLOY_APPLICATION: cicd-test-cd
AWS_CODE_DEPLOY_GROUP: cicd-test-cd-group
APPLICATION: ${{ secrets.APPLICATION }}
WORKING_DIRECTORY: ./
jobs:
build-with-gradle:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: JDK 17 설치
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
- name: 환경변수 설정
run: |
echo "${{env.APPLICATION}}" > ./src/main/resources/application.yml
- name: gradlew에 실행 권한 부여
run: chmod +x gradlew
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: 프로젝트 빌드
run: ./gradlew clean build -x test
- name: DockerHub 로그인
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: 도커 이미지 빌드 및 푸시
run: |
docker build -t ayeonii/leets-be:latest .
docker push ayeonii/leets-be:latest
- name: 배포
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_IP }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_IDENTITYFILE }}
port: ${{ secrets.REMOTE_PORT }}
script: |
cd server
docker compose -f docker-compose.yml down leets-be
docker compose -f docker-compose.yml pull leets-be
docker compose -f docker-compose.yml up -d leets-be