Skip to content
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
56 changes: 56 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Create Release

on:
push:
branches:
- main

permissions:
contents: write

jobs:
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v4.3.3
with:
versionSpec: '6.4.x'

- name: Execute GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v4.3.3

- name: Display version
run: |
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}"

- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.gitversion.outputs.semVer }}
release_name: Release v${{ steps.gitversion.outputs.semVer }}
body: |
## Release v${{ steps.gitversion.outputs.semVer }}

**Version Information:**
- Semantic Version: ${{ steps.gitversion.outputs.semVer }}
- Full SemVer: ${{ steps.gitversion.outputs.fullSemVer }}
- Informational Version: ${{ steps.gitversion.outputs.informationalVersion }}
- Branch: ${{ steps.gitversion.outputs.branchName }}
- Commit SHA: ${{ steps.gitversion.outputs.sha }}

See the [full changelog](https://github.com/${{ github.repository }}/compare/v${{ steps.gitversion.outputs.majorMinorPatch }}...v${{ steps.gitversion.outputs.semVer }}) for details.
draft: false
prerelease: false
60 changes: 38 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,68 @@ on: [push]

jobs:
version:
name: Calculate Version
runs-on: ubuntu-latest
name: Determine Version
outputs:
assemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}
majorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }}
sha: ${{ steps.gitversion.outputs.Sha }}
semVer: ${{ steps.gitversion.outputs.semVer }}
assemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}
informationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}
mmp: ${{ steps.gitversion.outputs.majorMinorPatch }}

steps:
- name: Checkout
uses: actions/checkout@v5
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 0 # Required for GitVersion

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3.2.1
uses: gittools/actions/gitversion/setup@v4.3.3
with:
versionSpec: "5.x"

- name: Determine Version
versionSpec: '6.4.x'
- name: Execute GitVersion
id: gitversion
uses: gittools/actions/gitversion/execute@v3.2.1
with:
useConfigFile: true
uses: gittools/actions/gitversion/execute@v4.3.3

- name: Display GitVersion outputs
run: |
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}"
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"

build:
needs: [version]
runs-on: ubuntu-latest
name: Build and Package
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
fetch-depth: 0

- uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0"

- run: dotnet build src -c Release /p:AssemblyVersion=${{ needs.version.outputs.assemblySemFileVer }} /p:FileVersion=${{ needs.version.outputs.assemblySemFileVer }} /p:InformationalVersion=${{ needs.version.outputs.sha }}
- name: Create test configuration
run: |
echo '{
"Sessionize": {
"BaseUrl": "https://sessionize.com",
"ApiId": "${{ secrets.SESSIONIZE_API_ID }}"
}
}' > src/Sessionize.Api.Client.IntegrationTests/appsettings-public-api.json

- run: dotnet build src -c Release /p:AssemblyVersion=${{ needs.version.outputs.informationalVersion }} /p:FileVersion=${{ needs.version.outputs.informationalVersion }} /p:InformationalVersion=${{ needs.version.outputs.informationalVersion }}
- run: dotnet test src
- run: dotnet pack src/Sessionize.Api.Client/Sessionize.Api.Client.csproj -c Release -p:AssemblyVersion=${{ needs.version.outputs.assemblySemFileVer }} -p:FileVersion=${{ needs.version.outputs.assemblySemFileVer }} -p:InformationalVersion=${{ needs.version.outputs.sha }} -p:PackageVersion=${{ needs.version.outputs.majorMinorPatch }}
- run: dotnet pack src/Sessionize.Api.Client/Sessionize.Api.Client.csproj -c Release -p:AssemblyVersion=${{ needs.version.outputs.informationalVersion }} -p:FileVersion=${{ needs.version.outputs.informationalVersion }} -p:InformationalVersion=${{ needs.version.outputs.informationalVersion }} -p:PackageVersion=${{ needs.version.outputs.mmp }}

- name: Publish Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: nuget-package
path: src/Sessionize.Api.Client/bin/Release/*${{ needs.version.outputs.majorMinorPatch }}.nupkg
path: src/Sessionize.Api.Client/bin/Release/*${{ needs.version.outputs.mmp }}.nupkg

deploy:
needs: [build, version]
Expand All @@ -58,17 +74,17 @@ jobs:
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@v6
with:
fetch-depth: 0

# - run: gh auth login --with-token ${{ secrets.GITHUB_TOKEN }}
- run: gh release create v${{ needs.version.outputs.majorMinorPatch }} --generate-notes
- run: gh release create v${{ needs.version.outputs.mmp }} --generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Download Artifact
uses: actions/download-artifact@v5
uses: actions/download-artifact@v7
with:
name: nuget-package
path: ./package
Expand Down
36 changes: 27 additions & 9 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Build and analyze
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/setup-dotnet@v5
Expand All @@ -21,40 +21,58 @@ jobs:
with:
java-version: 17
distribution: "zulu" # Alternative distribution options are available.

- name: Cache SonarCloud packages
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner

- name: Install SonarQube Cloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell

run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
New-Item -Path ${{ runner.temp }}\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path ${{ runner.temp }}\scanner

- name: Install dotnet-coverage
run: dotnet tool install --global dotnet-coverage

- name: Create test configuration
shell: powershell
run: |
@"
{
"Sessionize": {
"BaseUrl": "https://sessionize.com",
"ApiId": "${{ secrets.SESSIONIZE_API_ID }}"
}
}
"@ | Out-File -FilePath src\Sessionize.Api.Client.IntegrationTests\appsettings-public-api.json -Encoding utf8

- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"nikneem_sessionize-api-client" /o:"nikneem" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml
${{ runner.temp }}\scanner\dotnet-sonarscanner begin /k:"nikneem_sessionize-api-client" /o:"nikneem" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.scanner.scanAll=false
dotnet build src --no-incremental
dotnet-coverage collect "dotnet test src" -f xml -o coverage.xml
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
${{ runner.temp }}\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

- name: Publish Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: coverage-report
path: coverage.xml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,6 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml

# Sessionize API Client - Sensitive configuration files
**/appsettings-public-api.json
41 changes: 30 additions & 11 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
assembly-versioning-scheme: MajorMinorPatch
assembly-versioning-scheme: MajorMinorPatchTag
assembly-file-versioning-scheme: MajorMinorPatchTag
assembly-informational-format: "{InformationalVersion}"
mode: Mainline
assembly-informational-format: "{MajorMinorPatch}.{CommitsSinceVersionSource}"
mode: ContinuousDeployment
tag-prefix: "[vV]"
continuous-delivery-fallback-tag: ci
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
legacy-semver-padding: 4
build-metadata-padding: 4
commits-since-version-source-padding: 4
commit-message-incrementing: Enabled
branches: {}
branches:
main:
mode: ContinuousDeployment
label: ""
increment: Patch
regex: ^main$
master:
mode: ContinuousDeployment
label: ""
increment: Patch
regex: ^master$
pull-request:
mode: ContinuousDeployment
label: ""
increment: Patch
regex: ^(pull|pull\-requests|pr)[/-]
feature:
mode: ContinuousDeployment
label: ""
increment: Patch
regex: ^features?[/-]
develop:
mode: ContinuousDeployment
label: ""
increment: Patch
regex: ^(develop|development|gitversion)$
ignore:
sha: []
increment: Inherit
commit-date-format: yyyy-MM-dd
merge-message-formats: {}
increment: Patch
Loading
Loading