diff --git a/.github/workflows/on-pullrequest-recipe.yml b/.github/workflows/on-pullrequest-recipe.yml index ac656af..a33eeb9 100644 --- a/.github/workflows/on-pullrequest-recipe.yml +++ b/.github/workflows/on-pullrequest-recipe.yml @@ -1,5 +1,6 @@ name: Java with Spring CI + on: pull_request: branches: @@ -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 diff --git a/pom.xml b/pom.xml index 26d4bad..d693709 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,11 @@ h2 runtime + + org.postgresql + postgresql + runtime + org.springframework.boot spring-boot-devtools diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index c5d4daa..9219f6a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -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 \ No newline at end of file