Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Gradle templates for azure app service #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
@@ -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"
]
}
40 changes: 40 additions & 0 deletions AppService/java-jar-webapp-on-azure-gradle.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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"
]
}
Original file line number Diff line number Diff line change
@@ -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"
]
}
46 changes: 46 additions & 0 deletions FunctionApp/linux-java-functionapp-on-azure-gradle.yml
Original file line number Diff line number Diff line change
@@ -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
46 changes: 46 additions & 0 deletions FunctionApp/windows-java-functionapp-on-azure-gradle.yml
Original file line number Diff line number Diff line change
@@ -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