Skip to content

Commit

Permalink
chore: Initialization of repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Stéphane ANDRE committed Apr 25, 2024
0 parents commit 359a670
Show file tree
Hide file tree
Showing 25 changed files with 1,780 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"version": 1,
"isRoot": true,
"tools": {}
}
398 changes: 398 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
9 changes: 9 additions & 0 deletions .github/GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#next-version: 1.0.0
mode: ContinuousDeployment
assembly-versioning-scheme: MajorMinorPatchTag
assembly-informational-format: '{SemVer}+{ShortSha}'
branches:
main:
regex: ^main$
source-branches: [ 'release', 'feature' ]
tag: pre
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright (c) Stéphane ANDRE.
# Licensed under the MIT license.

# This continuous integration pipeline is triggered anytime a user pushes code to the repo.
# This pipeline builds the solution and runs unit tests

name: Build

on:
push:
branches:
- main
paths:
- .github/workflows/ci.yml
- .github/GitVersion.yml
- 'src/**'
workflow_dispatch:

jobs:

# GitVersion
gitversion:
runs-on: windows-latest
outputs:
SemVer: ${{ steps.gitversion.outputs.SemVer }}

steps:

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

# Install Git version
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

# Check Git version
- name: Check Git Semantic Version
id: gitversion
uses: gittools/actions/gitversion/[email protected] # https://github.com/GitTools/actions/blob/main/docs/examples/github/gitversion/execute/usage-examples.md
with:
useConfigFile: true
configFilePath: .\.github\GitVersion.yml
disableNormalization: true

# Build and test
build-and-tests:
uses: avantipoint/workflow-templates/.github/workflows/dotnet-build.yml@master # https://github.com/AvantiPoint/workflow-templates/blob/master/.github/workflows/dotnet-build.yml
needs: [ gitversion ]
with:
name: Build all projects
build-args: '/p:Version=${{ needs.gitversion.outputs.SemVer }}'
dotnet-test-logger: GitHubActions --no-build --no-restore
solution-path: .\src\MyNetHttp.sln
nugetFeedUrl: ${{ vars.PRIVATE_NUGET_API_SOURCE }}
secrets:
nugetUserName: ${{ vars.PRIVATE_NUGET_API_USERNAME }}
nugetToken: ${{ secrets.PRIVATE_NUGET_API_KEY }}
128 changes: 128 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Copyright (c) Stéphane ANDRE.
# Licensed under the MIT license.

# This continuous integration pipeline is triggered anytime a user pushes code to the repo.
# This pipeline create a release

name: Create Release

on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:

jobs:

# GitVersion
gitversion:
runs-on: windows-latest
outputs:
SemVer: ${{ steps.gitversion.outputs.SemVer }}

steps:

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

# Install Git version
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

# Check Git version
- name: Check Git Semantic Version
id: gitversion
uses: gittools/actions/gitversion/[email protected] # https://github.com/GitTools/actions/blob/main/docs/examples/github/gitversion/execute/usage-examples.md
with:
useConfigFile: true
configFilePath: .\.github\GitVersion.yml
disableNormalization: true

# Build and test
build:
uses: avantipoint/workflow-templates/.github/workflows/dotnet-build.yml@master # https://github.com/AvantiPoint/workflow-templates/blob/master/.github/workflows/dotnet-build.yml
needs: [ gitversion ]
with:
dotnet-test-logger: GitHubActions --no-build --no-restore
build-args: '/p:Version=${{needs.gitversion.outputs.SemVer}}'
name: Build
solution-path: .\src\MyNetHttp.sln

release:
runs-on: ubuntu-latest
needs: [ gitversion, build ]
env:
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
packageName: MyNet.Http
permissions:
contents: write
outputs:
version-name: ${{ steps.process-version.outputs.version-name }}
release-display-name: ${{ steps.process-version.outputs.release-display-name }}
is-preview: ${{ steps.process-version.outputs.is-preview }}

steps:

# Checkout
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

# Update CHANGELOG with all conventional commit from previous tag
- name: Update CHANGELOG
continue-on-error: true
id: changelog
uses: requarks/[email protected] # https://github.com/marketplace/actions/changelog-from-conventional-commits
with:
token: ${{ github.token }}
tag: ${{ github.ref_name }}

# Commit changes in CHANGELOG and skip CI
- name: Commit CHANGELOG.md
continue-on-error: true
uses: stefanzweifel/git-auto-commit-action@v4 # https://github.com/marketplace/actions/git-auto-commit
with:
branch: main
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md

# Download artifacts
- uses: actions/download-artifact@v3
with:
name: NuGet
path: Artifacts/

# Get package version
- name: Process Package Version
shell: bash
id: process-version
working-directory: Artifacts/
run: |
echo "Downloading package version script..."
curl -sS -o process-version.pl https://raw.githubusercontent.com/avantipoint/workflow-templates/master/build/process-version.pl
echo "Finished downloading package version script."
echo "Processing package version..."
perl process-version.pl ${{ env.packageName }}
# Create release
- uses: ncipollo/release-action@main # https://github.com/marketplace/actions/create-release
name: Create Release
with:
artifacts: "Artifacts/*.nupkg,Artifacts/*.snupkg"
artifactErrorsFailBuild: true
draft: true
generateReleaseNotes: false
token: ${{ github.token }}
name: "${{ steps.process-version.outputs.release-display-name }}"
prerelease: ${{ steps.process-version.outputs.is-preview }}
tag: v${{needs.gitversion.outputs.SemVer}}
body: ${{ steps.changelog.outputs.changes }}
38 changes: 38 additions & 0 deletions .github/workflows/git_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright (c) Stéphane ANDRE.
# Licensed under the MIT license.

name: Check Git Version

on:
workflow_dispatch:

jobs:

# GitVersion
gitversion:
runs-on: windows-latest
outputs:
SemVer: ${{ steps.gitversion.outputs.SemVer }}

steps:

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

# Install Git version
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

# Check Git version
- name: Check Git Semantic Version
id: gitversion
uses: gittools/actions/gitversion/[email protected] # https://github.com/GitTools/actions/blob/main/docs/examples/github/gitversion/execute/usage-examples.md
with:
useConfigFile: true
configFilePath: .\.github\GitVersion.yml
disableNormalization: true
75 changes: 75 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright (c) Stéphane ANDRE.
# Licensed under the MIT license.

# This continuous integration pipeline is triggered anytime a user pushes code to the repo.
# This pipeline builds the solution and runs unit tests

name: Publish Nugets - Private

on:
workflow_dispatch:

jobs:

# GitVersion
gitversion:
runs-on: windows-latest
outputs:
SemVer: ${{ steps.gitversion.outputs.SemVer }}

steps:

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

# Install Git version
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

# Check Git version
- name: Check Git Semantic Version
id: gitversion
uses: gittools/actions/gitversion/[email protected] # https://github.com/GitTools/actions/blob/main/docs/examples/github/gitversion/execute/usage-examples.md
with:
useConfigFile: true
configFilePath: .\.github\GitVersion.yml
disableNormalization: true

# Build and test
build:
uses: avantipoint/workflow-templates/.github/workflows/dotnet-build.yml@master # https://github.com/AvantiPoint/workflow-templates/blob/master/.github/workflows/dotnet-build.yml
needs: [ gitversion ]
with:
name: Build all projects
build-args: '/p:Version=${{ needs.gitversion.outputs.SemVer }}'
dotnet-test-logger: GitHubActions --no-build --no-restore
solution-path: .\src\MyNetHttp.sln
nugetFeedUrl: ${{ vars.PRIVATE_NUGET_API_SOURCE }}
secrets:
nugetUserName: ${{ vars.PRIVATE_NUGET_API_USERNAME }}
nugetToken: ${{ secrets.PRIVATE_NUGET_API_KEY }}

publish:
runs-on: ubuntu-latest
needs: [ gitversion, build ]

steps:

# Download artifacts
- uses: actions/download-artifact@v3
with:
name: NuGet
path: Artifacts/

# publish artifacts
- name: Publish NuGets
uses: dansiegel/publish-nuget@master # https://github.com/marketplace/actions/publish-nuget-packages
with:
filename: 'Artifacts/*.nupkg'
feedUrl: ${{ vars.PRIVATE_NUGET_API_SOURCE }}
apiKey: ${{ secrets.PRIVATE_NUGET_API_KEY }}
Loading

0 comments on commit 359a670

Please sign in to comment.