Skip to content

Commit 13124bb

Browse files
I did more stuff!
1 parent 5ead357 commit 13124bb

File tree

3 files changed

+151
-57
lines changed

3 files changed

+151
-57
lines changed

.github/workflows/api.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: API Deployment
2+
3+
env:
4+
registryName: {your_registry_name}.azurecr.io
5+
repositoryName: techexcel/csapi
6+
dockerFolderPath: ./src/ContosoSuitesWebAPI
7+
tag: ${{github.run_number}}
8+
9+
on:
10+
push:
11+
branches: [ main ]
12+
paths: src/ContosoSuitesWebAPI/**
13+
pull_request:
14+
branches: [ main ]
15+
paths: src/ContosoSuitesWebAPI/**
16+
# Allows you to run this workflow manually from the Actions tab
17+
workflow_dispatch:
18+
jobs:
19+
build:
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Setup .NET
26+
uses: actions/setup-dotnet@v4
27+
with:
28+
dotnet-version: 8.0
29+
30+
- name: Restore dependencies
31+
run: dotnet restore ./src/ContosoSuitesWebAPI/ContosoSuitesWebAPI.csproj
32+
- name: Build
33+
run: dotnet build --no-restore ./src/ContosoSuitesWebAPI/ContosoSuitesWebAPI.csproj
34+
35+
dockerBuildPush:
36+
runs-on: ubuntu-latest
37+
needs: build
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: Docker Login
43+
# You may pin to the exact commit or the version.
44+
# uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
45+
uses: docker/login-action@v3
46+
with:
47+
# Server address of Docker registry. If not set then will default to Docker Hub
48+
registry: ${{ secrets.ACR_LOGIN_SERVER }}
49+
# Username used to log against the Docker registry
50+
username: ${{ secrets.ACR_USERNAME }}
51+
# Password or personal access token used to log against the Docker registry
52+
password: ${{ secrets.ACR_PASSWORD }}
53+
# Log out from the Docker registry at the end of a job
54+
logout: true
55+
56+
- name: Docker Build
57+
run: docker build -t $registryName/$repositoryName:$tag --build-arg build_version=$tag $dockerFolderPath
58+
59+
- name: Docker Push
60+
run: docker push $registryName/$repositoryName:$tag
61+
62+
deploy-to-prod:
63+
64+
runs-on: ubuntu-latest
65+
needs: dockerBuildPush
66+
environment:
67+
name: prod
68+
url: https://{your_prefix}-api.azurewebsites.net/
69+
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- name: 'Login via Azure CLI'
74+
uses: azure/[email protected]
75+
with:
76+
creds: ${{ secrets.AZURE_CREDENTIALS }}
77+
78+
- uses: azure/webapps-deploy@v2
79+
with:
80+
app-name: '{your_prefix}-api'
81+
images: {your_registry_name}.azurecr.io/techexcel/csapi:${{github.run_number}}

.github/workflows/dashboard.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Dashboard Deployment
2+
3+
env:
4+
registryName: {your_registry_name}.azurecr.io
5+
repositoryName: techexcel/csdash
6+
dockerFolderPath: ./src/ContosoSuitesDashboard
7+
tag: ${{github.run_number}}
8+
9+
on:
10+
push:
11+
branches: [ main ]
12+
paths: src/ContosoSuitesDashboard/**
13+
pull_request:
14+
branches: [ main ]
15+
paths: src/ContosoSuitesDashboard/**
16+
# Allows you to run this workflow manually from the Actions tab
17+
workflow_dispatch:
18+
jobs:
19+
dockerBuildPush:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Docker Login
26+
# You may pin to the exact commit or the version.
27+
# uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
28+
uses: docker/login-action@v3
29+
with:
30+
# Server address of Docker registry. If not set then will default to Docker Hub
31+
registry: ${{ secrets.ACR_LOGIN_SERVER }}
32+
# Username used to log against the Docker registry
33+
username: ${{ secrets.ACR_USERNAME }}
34+
# Password or personal access token used to log against the Docker registry
35+
password: ${{ secrets.ACR_PASSWORD }}
36+
# Log out from the Docker registry at the end of a job
37+
logout: true
38+
39+
- name: Create Secrets File
40+
run: echo "$STREAMLIT_SECRETS" > ./src/ContosoSuitesDashboard/.streamlit/secrets.toml
41+
shell: bash
42+
env:
43+
STREAMLIT_SECRETS: ${{ secrets.STREAMLIT_SECRETS }}
44+
45+
- name: Docker Build
46+
run: docker build -t $registryName/$repositoryName:$tag --build-arg build_version=$tag $dockerFolderPath
47+
48+
- name: Docker Push
49+
run: docker push $registryName/$repositoryName:$tag
50+
51+
deploy-to-prod:
52+
53+
runs-on: ubuntu-latest
54+
needs: dockerBuildPush
55+
environment:
56+
name: prod
57+
url: https://{your_prefix}-dash.azurewebsites.net/
58+
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- name: 'Login via Azure CLI'
63+
uses: azure/[email protected]
64+
with:
65+
creds: ${{ secrets.AZURE_CREDENTIALS }}
66+
67+
- uses: azure/webapps-deploy@v2
68+
with:
69+
app-name: '{your_prefix}-dash'
70+
images: {your_registry_name}.azurecr.io/techexcel/csdash:${{github.run_number}}

.github/workflows/jekyll-gh-pages.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)