Skip to content

Bump System.Text.Json from 8.0.4 to 8.0.5 in /src/RepoGovernance.Core #1339

Bump System.Text.Json from 8.0.4 to 8.0.5 in /src/RepoGovernance.Core

Bump System.Text.Json from 8.0.4 to 8.0.5 in /src/RepoGovernance.Core #1339

Workflow file for this run

name: CI/CD
on:
push:
branches: [main]
pull_request:
jobs:
build:
runs-on: windows-latest
outputs:
Version: ${{ steps.gitversion.outputs.SemVer }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Display GitVersion outputs
run: |
echo "Version: ${{ steps.gitversion.outputs.SemVer }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: .NET publish
run: dotnet publish src/RepoGovernance.Core/RepoGovernance.Core.csproj -c Release -p:Version='${{ steps.gitversion.outputs.SemVer }}'
- name: Upload package back to GitHub
uses: actions/upload-artifact@v4
with:
name: drop
path: src/RepoGovernance.Core/bin/Release
- name: .NET publish service
run: dotnet publish src/RepoGovernance.Web/RepoGovernance.Web.csproj -c Release -p:Version='${{ steps.gitversion.outputs.SemVer }}' --output ${{ github.workspace }}/web
- name: Upload package back to GitHub
uses: actions/upload-artifact@v4
with:
name: web
path: ${{ github.workspace }}/web
- name: .NET publish website
run: dotnet publish src/RepoGovernance.Service/RepoGovernance.Service.csproj -c Release -p:Version='${{ steps.gitversion.outputs.SemVer }}' --output ${{ github.workspace }}/service
- name: Upload package back to GitHub
uses: actions/upload-artifact@v4
with:
name: service
path: ${{ github.workspace }}/service
- name: .NET publish function
run: dotnet publish src/RepoGovernance.Function/RepoGovernance.Function.csproj -c Release -p:Version='${{ steps.gitversion.outputs.SemVer }}' --output ${{ github.workspace }}/function
- name: Upload package back to GitHub
uses: actions/upload-artifact@v4
with:
name: function
path: ${{ github.workspace }}/function
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Variable Substitution appsettings file for tests
uses: microsoft/variable-substitution@v1
with:
files: 'src/RepoGovernance.Tests/appsettings.json'
env:
AppSettings.GitHubClientId: "${{ secrets.GitHubClientId }}"
AppSettings.GitHubClientSecret: "${{ secrets.GitHubClientSecret }}"
AppSettings.StorageConnectionString: "${{ secrets.StorageConnectionString }}"
AppSettings.CosmosDBConnectionString: "${{ secrets.CosmosDBConnectionString }}"
AppSettings.AzureTenantId: "${{ secrets.AzureTenantId }}"
AppSettings.AzureClientId: "${{ secrets.AzureClientId }}"
AppSettings.AzureClientSecret: "${{ secrets.AzureClientSecret }}"
#- run: echo "Tenant Id: $(env.AppSettings.AzureTenantId)"
- name: .NET test
run: dotnet test src/RepoGovernance.Tests/RepoGovernance.Tests.csproj --configuration Debug --logger trx -e:CollectCoverage=true -e:CoverletOutput=TestResults/ -e:CoverletOutputFormat=lcov -l "console;verbosity=detailed"
- name: Publish coverage report to coveralls.io
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: src/RepoGovernance.Tests/TestResults/coverage.info
continue-on-error: true
- name: Show test results
if: false
uses: samsmithnz/[email protected]
with:
fileName: ${{ github.workspace }}/TestOutput.xml
sonarCloud:
name: Run SonarCloud analysis
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Run Sonarcloud test
uses: samsmithnz/[email protected]
with:
projects: 'src/RepoGovernance.Core/RepoGovernance.Core.csproj,src/RepoGovernance.Tests/RepoGovernance.Tests.csproj,src/RepoGovernance.Service/RepoGovernance.Service.csproj,src/RepoGovernance.Web/RepoGovernance.Web.csproj,src/RepoGovernance.Function/RepoGovernance.Function.csproj'
dotnet-version: '8.0.x'
sonarcloud-organization: samsmithnz-github
sonarcloud-project: samsmithnz_RepoGovernance
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
deploy:
runs-on: windows-latest
needs:
- build
- test
- sonarCloud
if: github.ref == 'refs/heads/main'
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: service
path: service
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: web
path: web
- name: Log into Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_SP }}
- name: Set service secrets
run: az webapp config appsettings set --name "repogovernance-prod-eu-service" --resource-group "RepoGovernance" --settings "AppSettings:GitHubClientId=${{ secrets.GitHubClientId }}" "AppSettings:GitHubClientSecret=${{ secrets.GitHubClientSecret }}" "AppSettings:StorageConnectionString=${{ secrets.StorageConnectionString }}" "AppSettings:CosmosDBConnectionString=${{ secrets.CosmosDBConnectionString }}" "AppSettings:AzureTenantId=${{ secrets.AzureTenantId }}" "AppSettings:AzureClientId=${{ secrets.AzureClientId }}" "AppSettings:AzureClientSecret=${{ secrets.AzureClientSecret }}" #--slot staging
- name: Deploy to Azure Web App Service
id: deploy-to-servicesapp
uses: azure/webapps-deploy@v3
with:
app-name: repogovernance-prod-eu-service
package: service
- name: Deploy to Azure Web App Website
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: repogovernance-prod-eu-web
package: web
- name: Set website configuration
run: az webapp config appsettings set --name "repogovernance-prod-eu-web" --resource-group "RepoGovernance" --settings "WEBSITE_TIME_ZONE=Eastern Standard Time"
deployFunction:
runs-on: windows-latest
needs:
- build
- test
- sonarCloud
if: github.ref == 'refs/heads/main' && 0 == 1
environment:
name: 'production'
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: function
path: function
- name: Log into Azure
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_SP }}
- name: Set function secrets
run: az functionapp config appsettings set --name "repogovernance-prod-eu-schedulefunction" --resource-group "RepoGovernance" --settings "GitHubClientId=${{ secrets.GitHubClientId }}" "GitHubClientSecret=${{ secrets.GitHubClientSecret }}" "StorageConnectionString=${{ secrets.StorageConnectionString }}" "CosmosDBConnectionString=${{ secrets.CosmosDBConnectionString }}" "SummaryQueueConnection=${{ secrets.SummaryQueueConnection }}" "DevOpsServiceURL=https://devops-prod-eu-service.azurewebsites.net"
- name: Deploy Azure Function
uses: Azure/functions-action@v1
with:
app-name: repogovernance-prod-eu-schedulefunction
package: function
release:
runs-on: ubuntu-latest
needs:
- build
- deploy
#- deployFunction
if: github.ref == 'refs/heads/main'
environment:
name: 'production'
steps:
- name: Display GitVersion outputs
run: |
echo "Version: ${{ needs.build.outputs.Version }}"
echo "CommitsSinceVersionSource: ${{ needs.build.outputs.CommitsSinceVersionSource }}"
- name: Create Release
uses: ncipollo/release-action@v1
if: needs.build.outputs.CommitsSinceVersionSource > 0 #Only create a release if there has been a commit/version change
with:
tag: "v${{ needs.build.outputs.Version }}"
name: "v${{ needs.build.outputs.Version }}"
token: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token