-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (55 loc) · 2.07 KB
/
befly-dev-cd.yml
File metadata and controls
67 lines (55 loc) · 2.07 KB
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
name: 🚀Befly API Gateway CD
on:
pull_request:
types: [closed]
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Gateway Repository
uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.PAT }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: make p12 ssl certification
run: |
mkdir -p src/main/resources
echo "${{ secrets.P12_CERT_BASE64 }}" | base64 -d > src/main/resources/keystore.p12
- name: Set up Git authentication for submodules
run: |
git config --global url."https://${{ secrets.PAT }}@github.com".insteadOf "https://github.com"
git submodule update --init --recursive
- name: Build with Gradle
run: |
chmod +x ./gradlew
./gradlew clean build -x test
ls build/libs
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build Docker Image
run: |
docker build -f Dockerfile.dev -t ${{ secrets.DOCKER_USERNAME }}/befly-gateway:latest .
- name: Push to Docker Hub
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/befly-gateway:latest
- name: Connect SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
docker pull kohyunchoel/befly-gateway:latest
docker stop befly-gateway || true
docker rm befly-gateway || true
docker run -d --name befly-gateway \
-p 443:443 \
${{ secrets.DOCKER_USERNAME }}/befly-gateway:latest