This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
60 lines (51 loc) · 1.9 KB
/
azure-dev.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
name: Deploy to Azure Container Apps
on:
workflow_dispatch:
push:
branches:
- main
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
env:
AZURE_CLIENT_ID: ${{ vars.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ vars.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID }}
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Inject Secrets into YAML
run: |
sed -i 's#{DB_URL}#${{ secrets.DB_URL }}#' server/src/main/resources/application.yml
sed -i 's#{DB_USERNAME}#${{ secrets.DB_USERNAME }}#' server/src/main/resources/application.yml
sed -i 's#{DB_PASSWORD}#${{ secrets.DB_PASSWORD }}#' server/src/main/resources/application.yml
- name: Build with Gradle
run: |
cd server
./gradlew build -x test
- name: Log in to Docker Registry
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.AZURE_CONTAINER_REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and Push Docker Image
run: |
cd server
docker build . -t ${{ secrets.AZURE_CONTAINER_REGISTRY }}/server:latest
docker push ${{ secrets.AZURE_CONTAINER_REGISTRY }}/server:latest
- name: Deploy to Azure Container Apps
run: |
az containerapp update --name ${{ vars.AZURE_APP_NAME }} \
--resource-group ${{ vars.AZURE_RESOURCE_GROUP }} \
--image ${{ secrets.AZURE_CONTAINER_REGISTRY }}/server:latest