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
53 changes: 53 additions & 0 deletions .github/workflows/main_cookingwithethan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy JAR app to Azure Web App - CookingWithEthan

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Set up Java version
uses: actions/setup-java@v1
with:
java-version: '17'

- name: Build with Maven
run: mvn clean install

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v2
with:
name: java-app
path: '${{ github.workspace }}/target/*.jar'

deploy:
runs-on: windows-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v2
with:
name: java-app

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'CookingWithEthan'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_10EAA71046584F8C8CF3D793303AE1CC }}
package: '*.jar'
27 changes: 26 additions & 1 deletion src/main/java/com/example/demo/DemoApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

@SpringBootApplication
@RestController
Expand All @@ -15,6 +18,28 @@ public static void main(String[] args) {

@RequestMapping("/")
String sayHello() {
return "Hello World!";
return "Hello Again!";
}
}

public class DatabaseConnection {
public static void main(String[] args) {
// Database connection details
String url = "jdbc:postgresql://familyrecipes.postgres.database.azure.com:5432/{your_database}?user=fryees&password={your_password}&sslmode=require";
String username = "fryees@familyrecipes";
String password = "BENTLEYbear555!";


try {
Connection connection = DriverManager.getConnection(url, username, password);
System.out.println("Connected to the PostgreSQL database successfully!");
// Use the connection to query the database or perform other operations
// ...
connection.close();
} catch (SQLException e) {
System.out.println("Failed to connect to the PostgreSQL database: " + e.getMessage());
}
}
}


Binary file not shown.