-
Notifications
You must be signed in to change notification settings - Fork 3
62 lines (54 loc) · 1.62 KB
/
be-cd.yaml
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
name: Backend Deploy
on:
push:
branches:
- main
paths:
- backend/**
jobs:
deploy:
runs-on: ubuntu-latest
environment: prod
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: gradle
- name: Build
working-directory: backend
run: |
chmod +x gradlew
./gradlew build -x test
- name: Setup environment variables
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script: |
cd ~/${{ github.event.repository.name }}
echo "JASYPT_PASSWORD=${{ secrets.JASYPT_PASSWORD }}" > .env
echo "MYSQL_ROOT_PASSWORD=${{ secrets.MYSQL_ROOT_PASSWORD }}" >> .env
- name: Copy jar
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
source: docker-compose.yaml, backend/build/libs/
target: ~/${{ github.event.repository.name }}
- name: Restart docker compose
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
script: |
cd ~/${{ github.event.repository.name }}
docker compose stop be
docker compose rm -f be
docker compose up -d be