Skip to content

SB-28 (Feat) : Create gradle.yml #2

SB-28 (Feat) : Create gradle.yml

SB-28 (Feat) : Create gradle.yml #2

Workflow file for this run

name: Java CI with Gradle
on:
push:
branches: [ release ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Make application.yml
run: |
cd ./warehouse/src/main/resources
echo "${{ secrets.APPLICATION }}" > application.yml
- name: Make docker-compose.yml
run: |
cd ./
echo "${{ secrets.DOCKER_COMPOSE }}" > docker-compose.yml
- name: Build with Gradle
run: ./gradlew build
- name: Build and push Docker images
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml push
- name: Deploy to Server
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd /home/${{ secrets.SERVER_USERNAME }}/Baobab-SERVER
docker-compose down
docker-compose pull
docker-compose up -d