-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (42 loc) · 1.21 KB
/
prod-deploy.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
name: Prod CI/CD
on:
workflow_dispatch:
push:
branches: [ "production" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
- name: Create data.sql
run: |
cd ./src/main/resources
touch ./data.sql
echo "${{ secrets.DATA_SQL }}" > ./data.sql
- name: Build with Gradle
run: |
chmod +x ./gradlew
./gradlew clean build -x test
- name: Build the Docker image
run: |
docker login -u ${{ secrets.PROD_DOCKER_USERNAME }} -p ${{ secrets.PROD_DOCKER_PASSWORD }}
docker build -f Dockerfile -t ${{ secrets.PROD_DOCKER_REPO }} .
docker push ${{ secrets.PROD_DOCKER_REPO }}
- name: Deploy to server
uses: appleboy/ssh-action@master
id: deploy
with:
host: ${{ secrets.PROD_HOST }}
username: ${{ secrets.PROD_USERNAME }}
key: ${{ secrets.PROD_KEY }}
envs: GITHUB_SHA
script: |
cd ./buddies
bash deploy.sh