Skip to content

Commit

Permalink
feat(templates): improve sample pipelines of Boilerplate project temp…
Browse files Browse the repository at this point in the history
…late #7921 (#7926)
  • Loading branch information
ysmoradi authored Jul 3, 2024
1 parent 5f45166 commit 6b264f7
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 45 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/admin-sample.cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Admin Sample CD
# Project templates come equipped with CI/CD for both Azure DevOps and GitHub, providing you with a hassle-free way to get started with your new project. It is important to note that you should not depend on the contents of this file. More info at https://bitplatform.dev/templates/dev-ops

env:
API_SERVER_ADDRESS: 'https://adminpanel.bitplatform.dev/'
API_SERVER_ADDRESS: 'https://adminpanel.bitplatform.dev'
APP_SERVICE_NAME: 'bit-adminpanel'

on:
Expand Down Expand Up @@ -35,9 +35,9 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --serverUrl adminpanel.bitplatform.dev --filesStorage AzureBlobStorage
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --serverUrl ${{ env.API_SERVER_ADDRESS }} --filesStorage AzureBlobStorage
- name: Update appsettings.json api server address
- name: Update core appsettings.json
uses: devops-actions/[email protected]
with:
files: 'AdminPanel/src/Client/AdminPanel.Client.Core/appsettings.json'
Expand All @@ -63,7 +63,6 @@ jobs:
- name: Generate CSS/JS files
run: dotnet build AdminPanel/src/Client/AdminPanel.Client.Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" --no-restore -c Release

- name: Publish
run: dotnet publish AdminPanel/src/AdminPanel.Server/AdminPanel.Server.csproj -c Release -p:PwaEnabled=true -p:PublishTrimmed=true -p:TrimMode=partial -p:JsonSerializerIsReflectionEnabledByDefault=true --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}"

Expand Down Expand Up @@ -137,9 +136,9 @@ jobs:
cd src\Templates\Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ..\..\..\ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --windows --appInsights --appCenter --serverUrl adminpanel.bitplatform.dev --filesStorage AzureBlobStorage
cd ..\..\..\ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --windows --appInsights --appCenter --serverUrl ${{ env.API_SERVER_ADDRESS }} --filesStorage AzureBlobStorage
- name: Update appsettings.json api server address
- name: Update core appsettings.json
uses: devops-actions/[email protected]
with:
files: 'AdminPanel\src\Client\AdminPanel.Client.Core\appsettings.json'
Expand Down Expand Up @@ -198,7 +197,7 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --appCenter --serverUrl adminpanel.bitplatform.dev --filesStorage AzureBlobStorage
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --appCenter --serverUrl ${{ env.API_SERVER_ADDRESS }} --filesStorage AzureBlobStorage
- uses: actions/setup-node@v4
with:
Expand All @@ -211,7 +210,7 @@ jobs:
fileName: 'AdminPanel.keystore'
encodedString: ${{ secrets.ANDROID_RELEASE_KEYSTORE_FILE_BASE64 }}

- name: Update appsettings.json api server address
- name: Update core appsettings.json
uses: devops-actions/[email protected]
with:
files: 'AdminPanel/src/Client/AdminPanel.Client.Core/appsettings.json'
Expand Down Expand Up @@ -270,9 +269,9 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --appCenter --serverUrl adminpanel.bitplatform.dev --filesStorage AzureBlobStorage
cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --appCenter --serverUrl ${{ env.API_SERVER_ADDRESS }} --filesStorage AzureBlobStorage
- name: Update appsettings.json api server address
- name: Update core appsettings.json
uses: devops-actions/[email protected]
with:
files: 'AdminPanel/src/Client/AdminPanel.Client.Core/appsettings.json'
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/todo-sample.cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Todo Sample CD
# Project templates come equipped with CI/CD for both Azure DevOps and GitHub, providing you with a hassle-free way to get started with your new project. It is important to note that you should not depend on the contents of this file. More info at https://bitplatform.dev/templates/dev-ops

env:
API_SERVER_ADDRESS: 'https://todo.bitplatform.dev/'
API_SERVER_ADDRESS: 'https://todo.bitplatform.dev'

on:
workflow_dispatch:
Expand Down Expand Up @@ -38,9 +38,9 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --appInsights --serverUrl todo.bitplatform.dev --filesStorage AzureBlobStorage
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --appInsights --serverUrl ${{ env.API_SERVER_ADDRESS }} --filesStorage AzureBlobStorage
- name: Update appsettings.json api server address
- name: Update core appsettings.json
uses: devops-actions/[email protected]
with:
files: 'TodoSample/src/Client/TodoSample.Client.Core/appsettings.json'
Expand Down Expand Up @@ -152,9 +152,9 @@ jobs:
cd src\Templates\Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ..\..\..\ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --windows --appInsights --appCenter --serverUrl todo.bitplatform.dev --filesStorage AzureBlobStorage
cd ..\..\..\ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --windows --appInsights --appCenter --serverUrl ${{ env.API_SERVER_ADDRESS }} --filesStorage AzureBlobStorage
- name: Update appsettings.json api server address
- name: Update core appsettings.json
uses: devops-actions/[email protected]
with:
files: 'TodoSample\src\Client\TodoSample.Client.Core\appsettings.json'
Expand Down Expand Up @@ -217,7 +217,7 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --appInsights --appCenter --serverUrl todo.bitplatform.dev --filesStorage AzureBlobStorage
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --appInsights --appCenter --serverUrl ${{ env.API_SERVER_ADDRESS }} --filesStorage AzureBlobStorage
- name: Extract Android signing key from env
uses: timheuer/[email protected]
Expand All @@ -226,7 +226,7 @@ jobs:
fileName: 'TodoSample.keystore'
encodedString: ${{ secrets.ANDROID_RELEASE_KEYSTORE_FILE_BASE64 }}

- name: Update appsettings.json api server address
- name: Update core appsettings.json
uses: devops-actions/[email protected]
with:
files: 'TodoSample/src/Client/TodoSample.Client.Core/appsettings.json'
Expand Down Expand Up @@ -305,9 +305,9 @@ jobs:
cd src/Templates/Boilerplate && dotnet build -c Release
dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0
dotnet new install Bit.Boilerplate.0.0.0.nupkg
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --appInsights --appCenter --serverUrl todo.bitplatform.dev --filesStorage AzureBlobStorage
cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --appInsights --appCenter --serverUrl ${{ env.API_SERVER_ADDRESS }} --filesStorage AzureBlobStorage
- name: Update appsettings.json api server address
- name: Update core appsettings.json
uses: devops-actions/[email protected]
with:
files: 'TodoSample/src/Client/TodoSample.Client.Core/appsettings.json'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
# - name: Enable pre rendering
# run: sed -i 's/public static readonly bool PrerenderEnabled = false;/public static readonly bool PrerenderEnabled = true;/g' src/Client/Boilerplate.Client.Core/Services/AppRenderMode.cs

- name: Update appsettings.json api server address
- name: Update core appsettings.json
uses: devops-actions/[email protected]
with:
files: 'src/Client/Boilerplate.Client.Core/appsettings.json'
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
with:
node-version: 20

- name: Update appsettings.json api server address
- name: Update core appsettings.json
uses: devops-actions/[email protected]
with:
files: 'src\Client\Boilerplate.Client.Core\appsettings.json'
Expand Down Expand Up @@ -204,7 +204,7 @@ jobs:
fileName: 'Boilerplate.keystore'
encodedString: ${{ secrets.ANDROID_RELEASE_KEYSTORE_FILE_BASE64 }}

- name: Update appsettings.json api server address
- name: Update core appsettings.json
uses: devops-actions/[email protected]
with:
files: 'src/Client/Boilerplate.Client.Core/appsettings.json'
Expand Down Expand Up @@ -256,7 +256,7 @@ jobs:
with:
node-version: 20

- name: Update appsettings.json api server address
- name: Update core appsettings.json
uses: devops-actions/[email protected]
with:
files: 'src/Client/Boilerplate.Client.Core/appsettings.json'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ public class EmailSettings
public class SmsSettings
{
public string? FromPhoneNumber { get; set; }
public string? AccountSid { get; set; }
public string? AuthToken { get; set; }
public string? TwilioAccountSid { get; set; }
public string? TwilioAutoToken { get; set; }

public bool Configured => string.IsNullOrEmpty(FromPhoneNumber) is false &&
string.IsNullOrEmpty(AccountSid) is false &&
string.IsNullOrEmpty(AuthToken) is false;
string.IsNullOrEmpty(TwilioAccountSid) is false &&
string.IsNullOrEmpty(TwilioAutoToken) is false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private static void ConfigureServices(this WebApplicationBuilder builder)
services.TryAddTransient<SmsService>();
if (appSettings.Sms.Configured)
{
TwilioClient.Init(appSettings.Sms.AccountSid, appSettings.Sms.AuthToken);
TwilioClient.Init(appSettings.Sms.TwilioAccountSid, appSettings.Sms.TwilioAutoToken);
}

//#if (filesStorage == "Local")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,30 @@
//#if (database == "SqlServer")
"SqlServerConnectionString": "Data Source=(localdb)\\mssqllocaldb; Initial Catalog=BoilerplateDb;Integrated Security=true;Application Name=Boilerplate;TrustServerCertificate=True;",
//#elif (database == "Sqlite")
"SqliteConnectionString": "Data Source=App_Data/BoilerplateDb.db;", // To debug inside docker, change launchSettings.json
"SqliteConnectionString": "Data Source=App_Data/BoilerplateDb.db;",
"SqliteConnectionString_Comment": "To debug inside docker, change ConnectionStrings__SqliteConnectionString's value in launchSettings.json",
//#elif (database == "PostgreSQL")
"PostgreSQLConnectionString": "User ID=postgres;Password=123456;Host=localhost;Database=BoilerplateDb;",
//#endif
//#if (filesStorage == "AzureBlobStorage")
"AzureBlobStorageSasUrl": "emulator" // https://learn.microsoft.com/en-us/azure/ai-services/translator/document-translation/how-to-guides/create-sas-tokens?tabs=blobs#create-sas-tokens-in-the-azure-portal
"AzureBlobStorageSasUrl": "emulator",
"AzureBlobStorageSasUrl_Comment": "More info about blob storage sas url at https://learn.microsoft.com/en-us/azure/ai-services/translator/document-translation/how-to-guides/create-sas-tokens?tabs=blobs#create-sas-tokens-in-the-azure-portal"
//#endif
},
"DataProtectionCertificatePassword": "P@ssw0rdP@ssw0rd", // It can also be configured using: dotnet user-secrets set "DataProtectionCertificatePassword" "P@ssw0rdP@ssw0rd"
"DataProtectionCertificatePassword": "P@ssw0rdP@ssw0rd",
"DataProtectionCertificatePassword_Comment": "It can also be configured using: dotnet user-secrets set 'DataProtectionCertificatePassword' 'P@ssw0rdP@ssw0rd'",
"AppSettings": {
"Identity": {
"Issuer": "Boilerplate",
"Audience": "Boilerplate",
"RefreshTokenExpiration": "14.00:00:00", // Format: D.HH:mm:ss
"BearerTokenExpiration": "0.01:00:00", // Used as jwt's expiration claim, access token's expires in and cookie's max age. Format: D.HH:mm:ss
"EmailTokenRequestResendDelay": "0.00:02:00", // Format: D.HH:mm:ss
"PhoneNumberTokenRequestResendDelay": "0.00:02:00", // Format: D.HH:mm:ss
"ResetPasswordTokenRequestResendDelay": "0.00:02:00", // Format: D.HH:mm:ss
"TwoFactorTokenRequestResendDelay": "0.00:02:00", // Format: D.HH:mm:ss
"OtpRequestResendDelay": "0.00:02:00", // Format: D.HH:mm:ss"
"BearerTokenExpiration": "0.01:00:00",
"BearerTokenExpiration_Comment": "BearerTokenExpiration used as jwt's expiration claim, access token's expires in and cookie's max age. Format: D.HH:mm:ss",
"RefreshTokenExpiration": "14.00:00:00",
"EmailTokenRequestResendDelay": "0.00:02:00",
"PhoneNumberTokenRequestResendDelay": "0.00:02:00",
"ResetPasswordTokenRequestResendDelay": "0.00:02:00",
"TwoFactorTokenRequestResendDelay": "0.00:02:00",
"OtpRequestResendDelay": "0.00:02:00",
"Password": {
"RequireDigit": "false",
"RequiredLength": "6",
Expand All @@ -36,20 +40,21 @@
}
},
"Email": {
"Host": "LocalFolder", // Local folder means storing emails as .eml file in App_Data/sent-emails folder (Recommended for testing purposes only) instead of sending them using smtp server.
"Host": "LocalFolder",
"Host_Comment": "Local folder means storing emails as .eml file in App_Data/sent-emails folder (Recommended for testing purposes only) instead of sending them using smtp server.",
"Port": "587",
"DefaultFromEmail": "[email protected]",
"UserName": null,
"Password": null
},
"Sms": {
"FromPhoneNumber": null,
"AccountSid": null, /* Twilio */
"AutoToken": null
"TwilioAccountSid": null,
"TwilioAutoToken": null
},
"UserProfileImagesDir": "attachments/profiles/",
//#if (captcha == "reCaptcha")
"GoogleRecaptchaSecretKey": "6LdMKr4pAAAAANvngWNam_nlHzEDJ2t6SfV6L_DS",
"GoogleRecaptchaSecretKey": "6LdMKr4pAAAAANvngWNam_nlHzEDJ2t6SfV6L_DS"
//#endif
},
"Authentication": {
Expand All @@ -68,9 +73,12 @@
},
//#endif
"AllowedHosts": "*",
"ForwardedHeaders": { // These values apply only if your backend is hosted behind a CDN (such as Cloudflare).
"ForwardedHostHeaderName": "X-Forwarded-Host", // For Cloudflare, use X-Host instead of X-Forwarded-Host.
"ForwardedHeaders": {
"ForwardedHeaders_Comment": "These values apply only if your backend is hosted behind a CDN (such as Cloudflare).",
"ForwardedHostHeaderName": "X-Forwarded-Host",
"ForwardedHostHeaderName_Comment": "For Cloudflare, use X-Host instead of X-Forwarded-Host.",
"ForwardedHeaders": "All",
"AllowedHosts": "*" // Configure this in production with your backend URL host address (See appsettings.Production.json).
"AllowedHosts": "*",
"AllowedHosts_Comment": "Configure this in production with your backend URL host address (See appsettings.Production.json)"
}
}

0 comments on commit 6b264f7

Please sign in to comment.