-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (50 loc) · 1.77 KB
/
gongbaek-cd.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
name: DEPLOY
on:
push:
branches:
- release/**
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Jdk 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Debug Secrets
run: |
echo "Secrets YML value:"
echo "${{ secrets.PROD_CONFIG }}"
- name: Push yml file
run: |
mkdir -p ./src/main/resources
ls -l
echo ${{ secrets.PROD_CONFIG }} > ./src/main/resources/application-prod.yml
echo "hello is yml file push success?"
cat ./src/main/resources/application-prod.yml
- name: Build with Gradle
run: ./gradlew -x test clean build
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and Push Docker Image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/ggang:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/ggang:latest
- name: deploy appleboy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.PORT }}
script: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker pull ${{ secrets.DOCKER_USERNAME }}/ggang:latest
echo "now finished deploy: $(date '+%Y-%m-%d %H:%M:%S')" > deploy_success_date.txt