Fix github workflow variables #130
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
spring.jpa.open-in-view=false\n | |
spring.servlet.multipart.max-file-size=100MB\n | |
spring.servlet.multipart.max-request-size=1GB\n | |
spring.kafka.producer.bootstrap-servers=${{ vars.KAFKA_HOSTNAME }}:${{ vars.KAFKA_PORT }}\n | |
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer\n | |
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer\n | |
spring.kafka.consumer.bootstrap-servers=${{ vars.KAFKA_HOSTNAME }}:${{ vars.KAFKA_PORT }}\n | |
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer\n | |
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer\n | |
spring.kafka.consumer.group-id=0\n | |
kafka.topic=${{ vars.KAFKA_TOPIC }}\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 | |
minio.url=${{ secrets.MINIO_URL }}\n | |
minio.name=${{ secrets.MINIO_NAME }}\n | |
minio.secret=${{ secrets.MINIO_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: Build Foxogram Gateway | |
run: ./gradlew :foxogram-gateway:build | |
- name: Run Foxogram API | |
run: docker compose -f docker-compose-api.yml up foxogram-api${{ github.ref_name == 'dev' && '-dev' || '' }} -d --build | |
- name: Run Foxogram Gateway | |
run: docker compose -f docker-compose-gateway.yml up foxogram-gateway${{ github.ref_name == 'dev' && '-dev' || '' }} -d --build |