Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.
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
43 changes: 43 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy Java app to Azure Web Application

on:
[push]

# 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: Hjavawebapp # 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 node version to use

jobs:
build-and-deploy:
name: Build and Deploy
runs-on: ubuntu-latest
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 Maven
run: mvn package --file pom.xml
- name: Azure Login
uses: Azure/login@v1
with:
# Paste output of `az ad sp create-for-rbac` as value of secret variable: AZURE_CREDENTIALS
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 'Deploy to Azure WebApp'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/target/*.jar'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}

# 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
2 changes: 0 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ 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 node 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:
Expand All @@ -32,7 +31,6 @@ jobs:
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 }}/target/*.jar'

# For more information on GitHub Actions for Azure, refer to https://github.com/Azure/Actions
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
page_type: sample
page_type: sampleewe
languages: Java
products: GitHub
description: "Deploy Spring Petclinic application using GitHub Actions"
Expand Down