Skip to content

Commit

Permalink
preparing to ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
kleqing committed Nov 9, 2024
1 parent 1e60e42 commit 9ba6821
Show file tree
Hide file tree
Showing 10 changed files with 263 additions and 7 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/dynamics-charity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build and deploy .NET Core application to Web App dynamics-charity
on:
push:
branches:
- main
env:
AZURE_WEBAPP_NAME: dynamics-charity
AZURE_WEBAPP_PACKAGE_PATH: Dynamics/published
CONFIGURATION: Release
DOTNET_CORE_VERSION: 8.0.x
WORKING_DIRECTORY: Dynamics
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
- name: npm installation
run: npm install
- name: Restore
run: dotnet restore "${{ env.WORKING_DIRECTORY }}"
- name: Build
run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Test
run: dotnet test "${{ env.WORKING_DIRECTORY }}" --no-build
- name: Publish
run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}"
- name: Publish Artifacts
uses: actions/upload-artifact@v3
with:
name: webapp
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: webapp
path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
- name: Deploy to Azure WebApp
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.dynamics_charity_4A19 }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
13 changes: 13 additions & 0 deletions Dynamics/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.10",
"commands": [
"dotnet-ef"
],
"rollForward": false
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceGroupName": {
"type": "string",
"defaultValue": "dynamics-charity",
"metadata": {
"_parameterType": "resourceGroup",
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
}
},
"resourceGroupLocation": {
"type": "string",
"defaultValue": "southeastasia",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource group. Resource groups could have different location than resources."
}
},
"resourceLocation": {
"type": "string",
"defaultValue": "[parameters('resourceGroupLocation')]",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
}
}
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "[parameters('resourceGroupName')]",
"location": "[parameters('resourceGroupLocation')]",
"apiVersion": "2019-10-01"
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat('DynamicsDB', subscription().subscriptionId)))]",
"resourceGroup": "[parameters('resourceGroupName')]",
"apiVersion": "2019-10-01",
"dependsOn": [
"[parameters('resourceGroupName')]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"kind": "v12.0",
"location": "[parameters('resourceLocation')]",
"name": "dynamicscharitydatabase",
"type": "Microsoft.Sql/servers",
"apiVersion": "2017-10-01-preview"
},
{
"sku": {
"name": "GP_S_Gen5",
"tier": "GeneralPurpose",
"family": "Gen5",
"capacity": 2
},
"kind": "v12.0,user,vcore,serverless,freelimit",
"location": "[parameters('resourceLocation')]",
"name": "dynamicscharitydatabase/DynamicsDB",
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2017-10-01-preview",
"dependsOn": [
"dynamicscharitydatabase"
]
}
]
}
}
}
],
"metadata": {
"_dependencyType": "mssql.azure"
}
}
82 changes: 82 additions & 0 deletions Dynamics/Properties/ServiceDependencies/local/mssql1.arm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourceGroupName": {
"type": "string",
"defaultValue": "dynamics-charity",
"metadata": {
"_parameterType": "resourceGroup",
"description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
}
},
"resourceGroupLocation": {
"type": "string",
"defaultValue": "southeastasia",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource group. Resource groups could have different location than resources."
}
},
"resourceLocation": {
"type": "string",
"defaultValue": "[parameters('resourceGroupLocation')]",
"metadata": {
"_parameterType": "location",
"description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
}
}
},
"resources": [
{
"type": "Microsoft.Resources/resourceGroups",
"name": "[parameters('resourceGroupName')]",
"location": "[parameters('resourceGroupLocation')]",
"apiVersion": "2019-10-01"
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat('DynamicsDB', subscription().subscriptionId)))]",
"resourceGroup": "[parameters('resourceGroupName')]",
"apiVersion": "2019-10-01",
"dependsOn": [
"[parameters('resourceGroupName')]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"kind": "v12.0",
"location": "[parameters('resourceLocation')]",
"name": "dynamicscharitydatabase",
"type": "Microsoft.Sql/servers",
"apiVersion": "2017-10-01-preview"
},
{
"sku": {
"name": "GP_S_Gen5",
"tier": "GeneralPurpose",
"family": "Gen5",
"capacity": 2
},
"kind": "v12.0,user,vcore,serverless,freelimit",
"location": "[parameters('resourceLocation')]",
"name": "dynamicscharitydatabase/DynamicsDB",
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2017-10-01-preview",
"dependsOn": [
"dynamicscharitydatabase"
]
}
]
}
}
}
],
"metadata": {
"_dependencyType": "mssql.azure"
}
}
11 changes: 11 additions & 0 deletions Dynamics/Properties/serviceDependencies.dynamics-charity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"dependencies": {
"mssql1": {
"serviceConnectorResourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroupName')]/providers/Microsoft.Web/sites/dynamics-charity/providers/Microsoft.ServiceLinker/linkers/ConnectionStringsDefaultConnection_65D356F405",
"secretStore": "AzureAppSettings",
"resourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroupName')]/providers/Microsoft.Sql/servers/dynamicscharitydatabase/databases/DynamicsDB",
"type": "mssql.azure",
"connectionId": "ConnectionStrings:DefaultConnection"
}
}
}
8 changes: 8 additions & 0 deletions Dynamics/Properties/serviceDependencies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"dependencies": {
"mssql1": {
"type": "mssql",
"connectionId": "ConnectionStrings:DefaultConnection"
}
}
}
11 changes: 11 additions & 0 deletions Dynamics/Properties/serviceDependencies.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"dependencies": {
"mssql1": {
"serviceConnectorResourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroupName')]/providers/Microsoft.ServiceLinker/locations/southeastasia/connectors/ConnectionStringsDefaultConnection_65D356F405",
"secretStore": "LocalSecretsFile",
"resourceId": "/subscriptions/[parameters('subscriptionId')]/resourceGroups/[parameters('resourceGroupName')]/providers/Microsoft.Sql/servers/dynamicscharitydatabase/databases/DynamicsDB",
"type": "mssql.azure",
"connectionId": "ConnectionStrings:DefaultConnection"
}
}
}
6 changes: 3 additions & 3 deletions Dynamics/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Server=(local);Database=DynamicsDatabaseMerged;Trusted_Connection=True;TrustServerCertificate=True;MultipleActiveResultSets=true"
},
"ConnectionStrings": {
"DefaultConnection": "Server=tcp:dynamicscharitydb.database.windows.net,1433;Initial Catalog=DynamicsDB;Persist Security Info=False;User ID=dynamics;Password=@charityteam123;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;"
},
"Authentication": {
"Google": {
"ClientId": "615116714281-eu2ljgasqdmebkmfudrpg6nu3l6iorr3.apps.googleusercontent.com",
Expand Down
4 changes: 2 additions & 2 deletions Dynamics/wwwroot/css/output.css

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9ba6821

Please sign in to comment.