Skip to content

Commit 8e9ab56

Browse files
Update deploy workflow to also deploy to azure
1 parent 75c6ce5 commit 8e9ab56

File tree

1 file changed

+51
-3
lines changed

1 file changed

+51
-3
lines changed

.github/workflows/deploy.yml

+51-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,64 @@
1-
name: Publish Maven Package
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+
# Publish Maven artifact (.jar) to Github Packages Registry
5+
# Deploy Maven artifact to Azure Web App service
6+
name: Deploy & Publish
27

38
on:
49
workflow_run:
5-
workflows: ["Bump Package Version"]
10+
workflows: ["Build & Test"]
11+
branches:
12+
- master
613
types:
714
- completed
815
workflow_dispatch:
916

1017
jobs:
11-
publish:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v2
22+
# Setup java environment
23+
- name: Set up Java version
24+
uses: actions/setup-java@v1
25+
with:
26+
java-version: '8'
27+
# Build artifact
28+
- name: Build with Maven
29+
run: mvn clean install
30+
# Upload artifact
31+
- name: Upload artifact for deployment job
32+
uses: actions/upload-artifact@v2
33+
with:
34+
name: java-app
35+
path: '${{ github.workspace }}/target/*.jar'
36+
# Deploy to Azure app service
37+
deploy:
1238
runs-on: ubuntu-latest
39+
needs: build
40+
environment:
41+
name: 'production'
42+
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
43+
44+
steps:
45+
- name: Download artifact from build job
46+
uses: actions/download-artifact@v2
47+
with:
48+
name: java-app
1349

50+
- name: Deploy to Azure Web App
51+
id: deploy-to-webapp
52+
uses: azure/webapps-deploy@v2
53+
with:
54+
app-name: 'puff-course-management'
55+
slot-name: 'production'
56+
publish-profile: ${{ secrets.AzureAppService_PublishProfile_6ef5115cc7ff4b769924450f015f7ab6 }}
57+
package: '*.jar'
58+
# Publish maven artifact to Github
59+
publish:
60+
runs-on: ubuntu-latest
61+
needs: build
1462
steps:
1563
- uses: actions/checkout@v2
1664
- name: Set up JDK 1.8

0 commit comments

Comments
 (0)