-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (39 loc) · 1.42 KB
/
apiCode_deployment.yml
File metadata and controls
46 lines (39 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: APICode deployment
on:
release:
types: [published]
workflow_dispatch:
env:
AZURE_WEBAPP_NAME: swisshack
AZURE_MYSQL_DB_HOST: ${{ secrets.MYSQL_URL }}
AZURE_MYSQL_DB_USERNAME: ${{ secrets.MYSQL_USERNAME }}
AZURE_MYSQL_DB_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
defaults:
run:
working-directory: ./APICode
jobs:
build-and-deploy:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: maven
- name: Build & Push Image
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
mvn spring-boot:build-image -Pprod -Dspring-boot.build-image.imageName=${{ secrets.REGISTRY_SERVER }}/${{ env.AZURE_WEBAPP_NAME }}:${{ github.sha }}
docker push ${{ secrets.REGISTRY_SERVER }}/${{ env.AZURE_WEBAPP_NAME }}:${{ github.sha }}
- name: Deploy to Azure Web App for Container
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_API_PUBLISH_PROFILE }}
images: ${{ secrets.REGISTRY_SERVER }}/${{ env.AZURE_WEBAPP_NAME }}:${{ github.sha }}