-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (50 loc) · 1.78 KB
/
test-workflow.yml
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Build and deploy JAR app to Azure Container Instance - hilfling-backend
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java version
uses: actions/setup-java@v1
with:
java-version: "11"
- name: Build with Maven
run: mvn clean install
- name: Build Docker image
run: |
docker build -t hilfling-backend:${{ github.sha }} .
- name: Log in to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.ACR_LOGIN_SERVER }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Azure CLI Login
uses: azure/login@v1
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
- name: Delete existing Azure Container Instance
run: |
az container delete --resource-group hilfling-backend_group --name hilfling-backend --yes --no-wait
- name: Deploy to Azure Container Instance
run: |
az container create \
--resource-group hilfling-backend_group \
--name hilfling-backend \
--image ${{ secrets.ACR_LOGIN_SERVER }}/hilfling-backend:${{ github.sha }} \
--registry-login-server ${{ secrets.ACR_LOGIN_SERVER }} \
--registry-username ${{ secrets.ACR_USERNAME }} \
--registry-password ${{ secrets.ACR_PASSWORD }} \
--dns-name-label hilfling-backend \
--ports 80