diff --git a/AppService/Properties/java-jar-webapp-on-azure-gradle.properties.json b/AppService/Properties/java-jar-webapp-on-azure-gradle.properties.json new file mode 100644 index 00000000..c2dffd37 --- /dev/null +++ b/AppService/Properties/java-jar-webapp-on-azure-gradle.properties.json @@ -0,0 +1,8 @@ +{ + "name": "Gradle Java Web App to Azure", + "description": "Deploy Java Web App to Azure App Service with Gradle", + "iconName": "azure", + "categories": [ + "java" ,"Gradle" , "Deployment" + ] +} diff --git a/AppService/java-jar-webapp-on-azure-gradle.yml b/AppService/java-jar-webapp-on-azure-gradle.yml new file mode 100644 index 00000000..d15a0596 --- /dev/null +++ b/AppService/java-jar-webapp-on-azure-gradle.yml @@ -0,0 +1,40 @@ +name: Deploy Java Web App to Azure with Gradle + +on: + [push,pull_request] + +# CONFIGURATION +# For help, go to https://github.com/Azure/Actions +# +# 1. Set up the following secrets in your repository: +# AZURE_WEBAPP_PUBLISH_PROFILE +# +# 2. Change these variables for your configuration: +env: + AZURE_WEBAPP_NAME: JavaSpringPetclinic # set this to your application's name + AZURE_WEBAPP_PACKAGE_PATH: ${{ github.workspace }} # set this to the path to your web app project + JAVA_VERSION: '1.8' # set this to the Java version to use + AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} # set GH repo secret with the publish profile of the web app + +jobs: + build-and-deploy: + name: Build and Deploy + runs-on: ubuntu-latest + environment: dev + steps: + - uses: actions/checkout@master + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: ${{ env.JAVA_VERSION }} + - name: Build with Gradle + run: gradle build + - name: 'Deploy to Azure WebApp' + uses: azure/webapps-deploy@v2 + with: + app-name: ${{ env.AZURE_WEBAPP_NAME }} + publish-profile: ${{ env.AZURE_WEBAPP_PUBLISH_PROFILE }} + package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/build/libs/*.jar' + + # For more information on GitHub Actions for Azure, refer to https://github.com/Azure/Actions + # For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples diff --git a/FunctionApp/Properties/linux-java-functionapp-on-azure-gradle.properties.json b/FunctionApp/Properties/linux-java-functionapp-on-azure-gradle.properties.json new file mode 100644 index 00000000..ab090002 --- /dev/null +++ b/FunctionApp/Properties/linux-java-functionapp-on-azure-gradle.properties.json @@ -0,0 +1,8 @@ +{ + "name": "Gradle Java Serverless App to Azure", + "description": "Deploy Java App to Azure Functions with Gradle", + "iconName": "azure", + "categories": [ + "java" ,"Gradle" , "Deployment" + ] +} diff --git a/FunctionApp/Properties/windows-java-functionapp-on-azure-gradle.properties.json b/FunctionApp/Properties/windows-java-functionapp-on-azure-gradle.properties.json new file mode 100644 index 00000000..ab090002 --- /dev/null +++ b/FunctionApp/Properties/windows-java-functionapp-on-azure-gradle.properties.json @@ -0,0 +1,8 @@ +{ + "name": "Gradle Java Serverless App to Azure", + "description": "Deploy Java App to Azure Functions with Gradle", + "iconName": "azure", + "categories": [ + "java" ,"Gradle" , "Deployment" + ] +} diff --git a/FunctionApp/linux-java-functionapp-on-azure-gradle.yml b/FunctionApp/linux-java-functionapp-on-azure-gradle.yml new file mode 100644 index 00000000..dbcfdec0 --- /dev/null +++ b/FunctionApp/linux-java-functionapp-on-azure-gradle.yml @@ -0,0 +1,46 @@ +name: Deploy Java project to Azure Function App with Gradle + +on: + [push] + +# CONFIGURATION +# For help, go to https://github.com/Azure/Actions +# +# 1. Set up the following secrets in your repository: +# AZURE_FUNCTIONAPP_PUBLISH_PROFILE +# +# 2. Change these variables for your configuration: +env: + AZURE_FUNCTIONAPP_NAME: 'your-app-name' # set this to your function app name on Azure + BUILD_GRADLE_DIRECTORY: '.' # set this to the directory which contains build.gradle file + JAVA_VERSION: '8' # set this to the java version to use (e.g. '8', '11', '17') + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + environment: dev + steps: + - name: 'Checkout GitHub Action' + uses: actions/checkout@v3 + + - name: Setup Java Sdk ${{ env.JAVA_VERSION }} + uses: actions/setup-java@v1 + with: + java-version: ${{ env.JAVA_VERSION }} + + - name: 'Restore Project Dependencies Using Gradle' + shell: bash + run: | + pushd './${{ env.BUILD_GRADLE_DIRECTORY }}' + gradle azureFunctionsPackage -DappName=${{ env.AZURE_FUNCTIONAPP_NAME }} + popd + + - name: 'Run Azure Functions Action' + uses: Azure/functions-action@v1 + id: fa + with: + app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} + package: '${{ env.BUILD_GRADLE_DIRECTORY }}/build/azure-functions/${{ env.AZURE_FUNCTIONAPP_NAME }}' + publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} + +# For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples diff --git a/FunctionApp/windows-java-functionapp-on-azure-gradle.yml b/FunctionApp/windows-java-functionapp-on-azure-gradle.yml new file mode 100644 index 00000000..ecbbe7ae --- /dev/null +++ b/FunctionApp/windows-java-functionapp-on-azure-gradle.yml @@ -0,0 +1,46 @@ +name: Deploy Java project to Azure Function App with Gradle + +on: + [push] + +# CONFIGURATION +# For help, go to https://github.com/Azure/Actions +# +# 1. Set up the following secrets in your repository: +# AZURE_FUNCTIONAPP_PUBLISH_PROFILE +# +# 2. Change these variables for your configuration: +env: + AZURE_FUNCTIONAPP_NAME: 'your-app-name' # set this to your function app name on Azure + BUILD_GRADLE_DIRECTORY: '.' # set this to the directory which contains build.gradle file + JAVA_VERSION: '8' # set this to the java version to use (e.g. '8', '11', '17') + +jobs: + build-and-deploy: + runs-on: windows-latest + environment: dev + steps: + - name: 'Checkout GitHub Action' + uses: actions/checkout@v3 + + - name: Setup Java Sdk ${{ env.JAVA_VERSION }} + uses: actions/setup-java@v1 + with: + java-version: ${{ env.JAVA_VERSION }} + + - name: 'Restore Project Dependencies Using Gradle' + shell: pwsh + run: | + pushd './${{ env.BUILD_GRADLE_DIRECTORY }}' + gradle azureFunctionsPackage -DappName=${{ env.AZURE_FUNCTIONAPP_NAME }} + popd + + - name: 'Run Azure Functions Action' + uses: Azure/functions-action@v1 + id: fa + with: + app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }} + package: '${{ env.BUILD_GRADLE_DIRECTORY }}/build/azure-functions/${{ env.AZURE_FUNCTIONAPP_NAME }}' + publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }} + +# For more samples to get started with GitHub Action workflows to deploy to Azure, refer to https://github.com/Azure/actions-workflow-samples