-
Notifications
You must be signed in to change notification settings - Fork 4
42 lines (35 loc) · 1.68 KB
/
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
name: Deploy Foxogram
on:
push:
branches: [ "main", "dev" ]
jobs:
build:
runs-on: cloud
environment: ${{ github.ref_name == 'main' && 'production' || github.ref_name == 'dev' && 'development' || 'development' }}
steps:
- uses: actions/checkout@v4
- name: Create config
run: echo -e "spring.datasource.driver-class-name=org.postgresql.Driver\n
spring.datasource.username=${{ secrets.DB_USERNAME }}\n
spring.datasource.password=${{ secrets.DB_PASSWORD }}\n
spring.datasource.url=jdbc:postgresql://${{ secrets.DB_HOSTNAME }}:${{ secrets.DB_PORT }}/${{ secrets.DB_DATABASE }}\n
spring.jpa.hibernate.ddl-auto=update\n
smtp.host=${{ secrets.SMTP_HOSTNAME }}\n
smtp.port=${{ secrets.SMTP_PORT }}\n
smtp.username=${{ secrets.SMTP_USERNAME }}\n
smtp.password=${{ secrets.SMTP_PASSWORD }}\n
smtp.email=${{ secrets.SMTP_EMAIL }}\n
jwt.secret=${{ secrets.JWT_SECRET }}\n
api.version=1\n
api.env=${{ github.ref_name == 'main' && 'prod' || github.ref_name == 'dev' && 'dev' || 'dev' }}" >> foxogram-common/src/main/resources/application.properties
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'zulu'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- name: Build Foxogram API
run: ./gradlew :foxogram-api:build
- name: Run Foxogram API
run: docker compose -f docker-compose-${{ github.ref_name == 'main' && 'prod' || github.ref_name == 'dev' && 'dev' || 'dev' }}.yml up -d --build