Skip to content

Commit

Permalink
Merge pull request #43 from BudgetBuddiesTeam/feat/#1
Browse files Browse the repository at this point in the history
[Feat] CI/CD
  • Loading branch information
ggamD00 authored Jul 25, 2024
2 parents b9e08f5 + 8c9c1ce commit efe75b0
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: server


on:
push:
branches:
- dev

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

- name: Ensure resource directory exists
run: mkdir -p ./src/main/resources

- name : injection-yml
run : echo -E "${{ secrets.YML }}" > ./src/main/resources/application.yml

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Execute Gradle build and analyze
run: ./gradlew jib

- name: Run scripts in server
uses: appleboy/ssh-action@master
with:
key: ${{ secrets.PRIVATE_KEY }}
host: ${{ secrets.HOST_DEV }}
username: ${{ secrets.USERNAME }}
script: ${{ secrets.SCRIPT }}
19 changes: 19 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'java'
id 'org.springframework.boot' version '3.2.7'
id 'io.spring.dependency-management' version '1.1.5'
id 'com.google.cloud.tools.jib' version '3.4.3'
}

group = 'com.bbteam'
Expand Down Expand Up @@ -38,3 +39,21 @@ dependencies {
tasks.named('test') {
useJUnitPlatform()
}

jib {
from {
image = 'openjdk:17-alpine'
platforms {
platform {
architecture = 'amd64'
os = 'linux'
}
}
}
to {
image = 'binjumeoniz1/binjumeoniz:latest'
}
container {
jvmFlags = ['-Dspring.profiles.active=dev']
}
}

0 comments on commit efe75b0

Please sign in to comment.