-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (57 loc) · 2.05 KB
/
gradle.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
name: Java CI with Gradle
on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
## create application-database.yml
- name: make application-database.yml
run: |
mkdir -p src/main/resources
echo "${{ secrets.DATABASE }}" | base64 --decode > src/main/resources/application-database.yml
## create application-jwt.yml
- name: make application-jwt.yml
run: |
mkdir -p src/main/resources
echo "${{ secrets.JWT }}" | base64 --decode > src/main/resources/application-jwt.yml
## create application-oauth.yml
- name: make application-oauth.yml
run: |
mkdir -p src/main/resources
echo "${{ secrets.OAUTH }}" | base64 --decode > src/main/resources/application-oauth.yml
## Gradle 빌드 실행
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew clean build -x test
## 이미지 빌드 및 도커허브에 push
- name: spring docker build and push
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_USERNAME }}/peachmentor:pm-spring -f src/main/java/Dockerfile-java .
docker push ${{ secrets.DOCKER_USERNAME }}/peachmentor:pm-spring
## docker compose up
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
script: |
sudo docker rm -f spring
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/peachmentor:pm-spring
docker-compose up -d spring
docker image prune -f