-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (58 loc) · 1.74 KB
/
api-build-and-deploy.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
62
63
64
65
66
67
68
69
name: API – Build and Deploy
on:
push:
branches:
- prime
paths:
- api/**
- .github/workflows/api-build-and-deploy.yml
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
name: Build Job
steps:
- name: Validate Branch
id: validatebranch
run: |
[ $GITHUB_REF = refs/heads/prime ] || (echo 'Workflow must be run on branch “prime”!' && exit 1)
- name: Checkout
id: checkout
uses: actions/checkout@v3
- name: Test
id: test
run: dotnet test
working-directory: api
- name: Build
id: build
run: |
dotnet publish Sammo.Oeis.Api -c Release \
-p:PublishProfile=DefaultContainer -p:ContainerImageName=tmp -p:ContainerImageTags=$GITHUB_SHA
working-directory: api
- name: Login to GitHub Packages
id: dockerlogin
uses: docker/login-action@v2
with:
registry: ghcr.io
username: burkenyo
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push to GitHub Packages
id: dockerpush
run: |
docker tag tmp:$GITHUB_SHA ghcr.io/burkenyo/sammo-ga-api:$GITHUB_SHA
docker push ghcr.io/burkenyo/sammo-ga-api:$GITHUB_SHA
deploy:
runs-on: ubuntu-latest
name: Deployment Job
needs: build
steps:
- name: Login to Azure
id: azurelogin
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_AD_APP_IDENTITY_CREDENTIALS }}
- name: Deploy to Azure Container Apps
id: azuredeploy
run: |
az extension add -n containerapp
az containerapp update -n sammo-ga -g orangewave.io --image ghcr.io/burkenyo/sammo-ga-api:$GITHUB_SHA