-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (73 loc) · 2.73 KB
/
deploy-dev.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: deploy-dev
on:
push:
branches: [ develop ] #TODO: change trigger
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: gradle
- name: Create application-secret.yml
run: |
pwd
cd ./smeem-bootstrap/src/main/resources
touch ./application-secret.yml
echo "${{ secrets.APPLICATION_SECRET_YML }}" >> ./application-secret.yml
cat ./application-secret.yml
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Set FCM_JSON_PATH
run: echo "FCM_JSON_PATH=smeem-output-notification/src/main/resources/firebase-config/smeem_fcm_dev.json" >> $GITHUB_ENV
- name: Create FireBase JSON file From AWS
run: aws s3 cp --region ap-northeast-2 ${{ secrets.AWS_S3_FCM_JSON_URI_DEV }} ${{ env.FCM_JSON_PATH }}
- name: Build with Gradle
run: |
chmod +x ./gradlew
./gradlew build -x test
shell: bash
- name: Set docker
uses: docker/[email protected]
- name: Login docker
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_LOGIN_USERNAME_DEV }}
password: ${{ secrets.DOCKERHUB_LOGIN_ACCESSTOKEN_DEV }}
- name: Build docker image
run: |
docker build --platform linux/amd64 -t smeemdev/smeem-dev:latest -f Dockerfile-dev .
docker push smeemdev/smeem-dev:latest
deploy-cd:
needs: build
runs-on: ubuntu-20.04
steps:
- name: SSH로 서버 접속
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.RELEASE_SERVER_IP_DEV }}
username: ${{ secrets.RELEASE_SERVER_USER_DEV }}
key: ${{ secrets.RELEASE_SERVER_KEY_DEV }}
script: |
cd ~
# deploy.sh 파일 다운로드
wget https://raw.githubusercontent.com/Team-Smeme/Smeme-server-renewal/develop/script/deploy.sh -O deploy.sh
chmod +x deploy.sh
# .env 파일 추가
if ! grep -q "REGISTRY_URL=" .env; then
echo "REGISTRY_URL=${{ secrets.REGISTRY_URL_DEV }}" >> .env
fi
if ! grep -q "IMAGE_NAME=" .env; then
echo "IMAGE_NAME=${{ secrets.IMAGE_NAME_DEV }}" >> .env
fi
# 배포 스크립트 실행
sudo ./deploy.sh