Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/on-pullrequest-recipe.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Java with Spring CI


on:
pull_request:
branches:
Expand All @@ -25,4 +26,31 @@ jobs:
with:
push: true
tags: ghcr.io/thomasdelecluse/api_todolist_cicd:latest
deploy:
needs: docker
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: SSH to Server
uses: appleboy/ssh-action@master
with:
host: 34.200.26.248
username: ubuntu
key: ${{ secrets.SSH_PRIVATE_KEY }}

# Optional: If you need to execute specific commands on the server
script: |
echo "Connected to the server via SSH"
# Add your desired commands here
# Example: npm run build


docker login ghcr.io -u thomasdelecluse -p ${{ secrets.TOKEN }}
docker stop api-todolist
docker rm api-todolist
docker pull ghcr.io/thomasdelecluse/api_todolist_cicd:latest
docker run -d --name api-todolist -p 8080:8080 ghcr.io/thomasdelecluse/api_todolist_cicd:latest

5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
Expand Down
16 changes: 11 additions & 5 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
#spring.datasource.url=jdbc:h2:mem:testdb
#spring.datasource.driverClassName=org.h2.Driver
#spring.datasource.username=sa
#spring.datasource.password=
#spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

spring.datasource.url=jdbc:postgresql://postgres:5432/db
spring.datasource.username=admin
spring.datasource.password=admin
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update

server.port=8080