Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add GH Action Template #449

Merged
merged 11 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion templates/Coalesce.Vue.Template/TestLocal.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ dotnet new coalescevue --help

foreach ($testCase in $testCases) {
Write-Output "-------TEST CASE------"
Write-Output (!$testCase ? "<no options enabled>" : $testCase);
if (-not $testCase) {
Write-Output "<no options enabled>"
} else {
Write-Output $testCase
}
Write-Output "----------------------"
Write-Output ""

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Build, Test, and Deploy Coalesce.Starter.Vue

# https://docs.github.com/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

# CONFIGURATION
# For help, go to https://github.com/Azure/Actions
#
# 1. Set up the production Environment in the GitHub Repository Settings.
# Environment Protection Rules are recommended to prevent accidental deployments.
# https://docs.github.com/actions/managing-workflow-runs-and-deployments/managing-deployments/managing-environments-for-deployment#deployment-protection-rules
#
# 2. Set up the following secrets in your repository - https://docs.github.com/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-an-environment
# AZURE_WEBAPP_PUBLISH_PROFILE
#
# 3. Change these variables for your configuration:
env:
AZURE_WEBAPP_NAME: MY_WEBAPP_NAME # set this to your app service name

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
lfs: true

- name: Use .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
include-preview: true

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x

- name: npm ci
run: npm ci
working-directory: Coalesce.Starter.Vue.Web

- name: Restore Nuget packages
run: dotnet restore

- name: Check Coalesce has been run
run: dotnet coalesce --what-if --verify
working-directory: Coalesce.Starter.Vue.Web

- name: npm run lint
run: npm run lint
working-directory: Coalesce.Starter.Vue.Web

- name: npm run build
run: npm run build
working-directory: Coalesce.Starter.Vue.Web

- name: dotnet build
run: dotnet build --configuration Release --no-restore --no-incremental

- name: dotnet test
run: dotnet test --configuration Release --no-restore --no-build

- name: dotnet publish
run: dotnet publish ${{ github.workspace }}/Coalesce.Starter.Vue.Web/Coalesce.Starter.Vue.Web.csproj --configuration Release --output ${{ github.workspace }}/publish --no-restore --no-build

- name: Upload artifact for deployment
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: .coalesce-app
path: ${{ github.workspace }}/publish
if-no-files-found: error

# Deploys the app to Azure App Service
# https://docs.github.com/actions/use-cases-and-examples/deploying/deploying-net-to-azure-app-service
deploy-production:
needs: build-and-test
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact for deployment
uses: actions/download-artifact@v4
with:
name: .coalesce-app

- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v3
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
slot-name: 'production'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: .
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@
"datatype": "bool",
"displayName": "Sign-in with Microsoft",
"description": "Adds Microsoft as an external authentication and account provider for Identity.",
"$coalesceRequires": ["and", "Identity"],
"$coalesceRequires": [ "and", "Identity" ],
"$coalesceLink": "https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/microsoft-logins"
},
"GoogleAuth": {
"type": "parameter",
"datatype": "bool",
"displayName": "Sign-in with Google",
"description": "Adds Google as an external authentication and account provider for Identity.",
"$coalesceRequires": ["and", "Identity"],
"$coalesceRequires": [ "and", "Identity" ],
"$coalesceLink": "https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/google-logins"
},
"UserPictures": {
"type": "parameter",
"datatype": "bool",
"displayName": "User Profile Pictures",
"description": "Adds infrastructure for acquiring, saving, and displaying user profile pictures.",
"$coalesceRequires": ["and", "Identity"]
"$coalesceRequires": [ "and", "Identity" ]
},
"TrackingBase": {
"type": "parameter",
Expand Down Expand Up @@ -103,6 +103,13 @@
"displayName": "CI: Azure Pipelines",
"description": "Include an azure-pipelines.yml build template. For deployments, a release pipeline is recommended (which don't support YAML config files).",
"$coalesceLink": "https://learn.microsoft.com/en-us/azure/devops/pipelines/create-first-pipeline?view=azure-devops&tabs=net%2Cbrowser"
},
"GithubActions": {
"type": "parameter",
"datatype": "bool",
"displayName": "CI: Github Actions",
"description": "Include an build-test-and-deploy.yml github action file template.",
"$coalesceLink": "https://docs.github.com/actions/use-cases-and-examples/deploying/deploying-net-to-azure-app-service"
}
},
"sources": [
Expand Down Expand Up @@ -167,7 +174,11 @@
},
{
"condition": "!AzurePipelines",
"exclude": ["**/azure-pipelines.yml"]
"exclude": [ "**/azure-pipelines.yml" ]
},
{
"condition": "!GithubActions",
"exclude": [ "**/.github" ]
}
]
}
Expand Down

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"dependencies": {
"@fortawesome/fontawesome-free": "^6.6.0",
"@vueuse/core": "^11.0.3",
"coalesce-vue": "5.0.0-ci.20240905.3",
"coalesce-vue-vuetify3": "5.0.0-ci.20240905.3",
"coalesce-vue": "5.0.0",
"coalesce-vue-vuetify3": "5.0.0",
"typeface-roboto": "1.1.13",
"vue": "^3.5.0",
"vue-router": "^4.4.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ import { useTheme } from "vuetify";

const drawer = ref<boolean | null>(null);

//#if Identity
const router = useRouter();
const { userInfo } = useUser();
//#endif
//#if DarkMode
const vuetifyTheme = useTheme();

Expand Down

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>5.5</TypeScriptToolsVersion>

<CoalesceVersion>5.0.0-ci.20240905.3</CoalesceVersion>
<CoalesceVersion>5.0.0</CoalesceVersion>

<!--#if (KeepTemplateOnly) -->
<DefineConstants>KeepTemplateOnly;AppInsights;OpenAPI;Identity;MicrosoftAuth;GoogleAuth;AuditLogs;UserPictures;TrackingBase;ExampleModel</DefineConstants>
Expand Down
6 changes: 0 additions & 6 deletions templates/Coalesce.Vue.Template/content/package-lock.json

This file was deleted.