Skip to content

Commit

Permalink
Main
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
larrywa committed Sep 26, 2024
1 parent a09f4a1 commit a47910e
Show file tree
Hide file tree
Showing 7 changed files with 263 additions and 149 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: API Deployment

env:
registryName: op3eqv3gu7pvecosureg.azurecr.io
repositoryName: techexcel/csapi
dockerFolderPath: ./src/ContosoSuitesWebAPI
tag: ${{github.run_number}}

on:
push:
branches: [ main ]
paths: src/ContosoSuitesWebAPI/**
pull_request:
branches: [ main ]
paths: src/ContosoSuitesWebAPI/**
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0

- name: Restore dependencies
run: dotnet restore ./src/ContosoSuitesWebAPI/ContosoSuitesWebAPI.csproj
- name: Build
run: dotnet build --no-restore ./src/ContosoSuitesWebAPI/ContosoSuitesWebAPI.csproj

dockerBuildPush:
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v4

- name: Docker Login
# You may pin to the exact commit or the version.
# uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
uses: docker/login-action@v3
with:
# Server address of Docker registry. If not set then will default to Docker Hub
registry: ${{ secrets.ACR_LOGIN_SERVER }}
# Username used to log against the Docker registry
username: ${{ secrets.ACR_USERNAME }}
# Password or personal access token used to log against the Docker registry
password: ${{ secrets.ACR_PASSWORD }}
# Log out from the Docker registry at the end of a job
logout: true

- name: Docker Build
run: docker build -t $registryName/$repositoryName:$tag --build-arg build_version=$tag $dockerFolderPath

- name: Docker Push
run: docker push $registryName/$repositoryName:$tag

deploy-to-prod:

runs-on: ubuntu-latest
needs: dockerBuildPush
environment:
name: prod
url: https://op3eqv3gu7pve-api.azurewebsites.net/

steps:
- uses: actions/checkout@v4

- name: 'Login via Azure CLI'
uses: azure/[email protected]
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- uses: azure/webapps-deploy@v2
with:
app-name: '{your_prefix}-api'
images: {your_registry_name}.azurecr.io/techexcel/csapi:${{github.run_number}}
70 changes: 70 additions & 0 deletions .github/workflows/dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Dashboard Deployment

env:
registryName: op3eqv3gu7pvecosureg.azurecr.io
repositoryName: techexcel/csdash
dockerFolderPath: ./src/ContosoSuitesDashboard
tag: ${{github.run_number}}

on:
push:
branches: [ main ]
paths: src/ContosoSuitesDashboard/**
pull_request:
branches: [ main ]
paths: src/ContosoSuitesDashboard/**
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
dockerBuildPush:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Docker Login
# You may pin to the exact commit or the version.
# uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
uses: docker/login-action@v3
with:
# Server address of Docker registry. If not set then will default to Docker Hub
registry: ${{ secrets.ACR_LOGIN_SERVER }}
# Username used to log against the Docker registry
username: ${{ secrets.ACR_USERNAME }}
# Password or personal access token used to log against the Docker registry
password: ${{ secrets.ACR_PASSWORD }}
# Log out from the Docker registry at the end of a job
logout: true

- name: Create Secrets File
run: echo "$STREAMLIT_SECRETS" > ./src/ContosoSuitesDashboard/.streamlit/secrets.toml
shell: bash
env:
STREAMLIT_SECRETS: ${{ secrets.STREAMLIT_SECRETS }}

- name: Docker Build
run: docker build -t $registryName/$repositoryName:$tag --build-arg build_version=$tag $dockerFolderPath

- name: Docker Push
run: docker push $registryName/$repositoryName:$tag

deploy-to-prod:

runs-on: ubuntu-latest
needs: dockerBuildPush
environment:
name: prod
url: https://op3eqv3gu7pve-dash.azurewebsites.net/

steps:
- uses: actions/checkout@v4

- name: 'Login via Azure CLI'
uses: azure/[email protected]
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- uses: azure/webapps-deploy@v2
with:
app-name: '{your_prefix}-dash'
images: {your_registry_name}.azurecr.io/techexcel/csdash:${{github.run_number}}
57 changes: 0 additions & 57 deletions .github/workflows/jekyll-gh-pages.yml

This file was deleted.

20 changes: 10 additions & 10 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to .NET Functions",
"type": "coreclr",
"request": "attach",
"processId": "${command:azureFunctions.pickProcess}"
}
]
}
"version": "0.2.0",
"configurations": [
{
"name": "Attach to .NET Functions",
"type": "coreclr",
"request": "attach",
"processId": "${command:azureFunctions.pickProcess}"
}
]
}
160 changes: 80 additions & 80 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "clean (functions)",
"command": "dotnet",
"args": [
"clean",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/src\\ContosoSuitesVectorizationFunction"
}
},
{
"label": "build (functions)",
"command": "dotnet",
"args": [
"build",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"dependsOn": "clean (functions)",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/src\\ContosoSuitesVectorizationFunction"
}
},
{
"label": "clean release (functions)",
"command": "dotnet",
"args": [
"clean",
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/src\\ContosoSuitesVectorizationFunction"
}
},
{
"label": "publish (functions)",
"command": "dotnet",
"args": [
"publish",
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"dependsOn": "clean release (functions)",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/src\\ContosoSuitesVectorizationFunction"
}
},
{
"type": "func",
"dependsOn": "build (functions)",
"options": {
"cwd": "${workspaceFolder}/src/ContosoSuitesVectorizationFunction/bin/Debug/net8.0"
},
"command": "host start",
"isBackground": true,
"problemMatcher": "$func-dotnet-watch"
}
]
}
"version": "2.0.0",
"tasks": [
{
"label": "clean (functions)",
"command": "dotnet",
"args": [
"clean",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/src\\ContosoSuitesVectorizationFunction"
}
},
{
"label": "build (functions)",
"command": "dotnet",
"args": [
"build",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"dependsOn": "clean (functions)",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/src\\ContosoSuitesVectorizationFunction"
}
},
{
"label": "clean release (functions)",
"command": "dotnet",
"args": [
"clean",
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/src\\ContosoSuitesVectorizationFunction"
}
},
{
"label": "publish (functions)",
"command": "dotnet",
"args": [
"publish",
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"dependsOn": "clean release (functions)",
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/src\\ContosoSuitesVectorizationFunction"
}
},
{
"type": "func",
"dependsOn": "build (functions)",
"options": {
"cwd": "${workspaceFolder}/src/ContosoSuitesVectorizationFunction/bin/Debug/net8.0"
},
"command": "host start",
"isBackground": true,
"problemMatcher": "$func-dotnet-watch"
}
]
}
Loading

0 comments on commit a47910e

Please sign in to comment.