Skip to content

Commit f982513

Browse files
committed
Add or update the Azure App Service build and deployment workflow config
1 parent d8a5e80 commit f982513

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
2+
# More GitHub Actions for Azure: https://github.com/Azure/actions
3+
4+
name: Build and deploy JAR app to Azure Web App - blog-platform-api
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read #This is required for actions/checkout
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Java version
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '21'
25+
distribution: 'microsoft'
26+
27+
- name: Build with Maven
28+
run: mvn clean install
29+
30+
- name: Upload artifact for deployment job
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: java-app
34+
path: '${{ github.workspace }}/target/*.jar'
35+
36+
deploy:
37+
runs-on: ubuntu-latest
38+
needs: build
39+
environment:
40+
name: 'Production'
41+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
42+
permissions:
43+
id-token: write #This is required for requesting the JWT
44+
contents: read #This is required for actions/checkout
45+
46+
steps:
47+
- name: Download artifact from build job
48+
uses: actions/download-artifact@v4
49+
with:
50+
name: java-app
51+
52+
- name: Login to Azure
53+
uses: azure/login@v2
54+
with:
55+
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_3EBA105382114BD597F511B1859C8EFC }}
56+
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_B7165AC391B54395B63E1BFF3B8E5AB9 }}
57+
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_2AA366E375FC4D95A3E25EB84D7F86D4 }}
58+
59+
- name: Deploy to Azure Web App
60+
id: deploy-to-webapp
61+
uses: azure/webapps-deploy@v3
62+
with:
63+
app-name: 'blog-platform-api'
64+
slot-name: 'Production'
65+
package: '*.jar'
66+

0 commit comments

Comments
 (0)