-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (69 loc) · 2.13 KB
/
api.yaml
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Api
env:
IMAGE_NAME: ${{ github.repository }}
on:
push:
branches:
- master
jobs:
changes:
name: Check changes
runs-on: ubuntu-latest
outputs:
src: ${{ steps.changes.outputs.build }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
build:
- 'src/backend/Applications/ScanIta.Extractor.Api/**'
build-and-push:
needs: changes
if: ${{ needs.changes.outputs.src == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.x'
- name: Build
run: dotnet build --configuration Release
- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ghcr.io/tiaringhio/scanitaextractor
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./src/backend/Applications/ScanIta.Extractor.Api/Dockerfile
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: ghcr.io/tiaringhio/scanitaextractor:latest , ghcr.io/tiaringhio/scanitaextractor:${{ github.sha }}
deploy:
needs: [build-and-push]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Log in to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Create new revision
uses: Azure/cli@v1
with:
inlineScript: |
echo "Installing containerapp extension"
az extension add -n containerapp
echo "Creating new revision"
az containerapp update -n ${{ secrets.API_NAME }} -g ${{ secrets.AZURE_RG }} --image ghcr.io/tiaringhio/scanitaextractor:${{ github.sha }}