Skip to content

Commit

Permalink
chore: Initialization of repository
Browse files Browse the repository at this point in the history
  • Loading branch information
sandre58 committed May 6, 2024
0 parents commit 2249a7b
Show file tree
Hide file tree
Showing 43 changed files with 3,367 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
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Copyright (c) Stéphane ANDRE.
# Licensed under the MIT license.

# This continuous integration pipeline is triggered anytime a user pushes code to main branch.
# 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:
timeout-minutes: 5
runs-on: windows-latest
outputs:
full_version: ${{ steps.gitversion.outputs.SemVer }}
suffix_label: ${{ steps.gitversion.outputs.PreReleaseLabel }}

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
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
build-args: '/p:GitVersion=${{ needs.gitversion.outputs.full_version }} /p:VersionSuffix=${{ needs.gitversion.outputs.suffix_label }}'
dotnet-test-logger: GitHubActions --no-build --no-restore
solution-path: .\src\MyIconCreator.sln
nugetFeedUrl: ${{ vars.PRIVATE_NUGET_API_SOURCE }}
artifact-name: IconCreator
artificats-path: |
./build/IconCreator/Release/**
!./build/IconCreator/Release/*.xml
!./build/IconCreator/Release/*.pdb
secrets:
nugetUserName: ${{ vars.PRIVATE_NUGET_API_USERNAME }}
nugetToken: ${{ secrets.PRIVATE_NUGET_API_KEY }}
147 changes: 147 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Copyright (c) Stéphane ANDRE.
# Licensed under the MIT license.

# This continuous integration pipeline is triggered anytime a user pushes a tag. Could be trigger by user action.
# This pipeline builds solution, update CHANGELOG.md and creates a draft release

name: Create Release

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

jobs:

# GitVersion
gitversion:
timeout-minutes: 5
runs-on: windows-latest
outputs:
full_version: ${{ steps.gitversion.outputs.SemVer }}
suffix_label: ${{ steps.gitversion.outputs.PreReleaseLabel }}
version: ${{ steps.gitversion.outputs.MajorMinorPatch }}

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
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
build-args: '/p:GitVersion=${{ needs.gitversion.outputs.full_version }} /p:VersionSuffix=${{ needs.gitversion.outputs.suffix_label }}'
dotnet-test-logger: GitHubActions --no-build --no-restore
solution-path: .\src\MyIconCreator.sln
nugetFeedUrl: ${{ vars.PRIVATE_NUGET_API_SOURCE }}
artifact-name: IconCreator
artificats-path: |
./build/IconCreator/Release/**
!./build/IconCreator/Release/*.xml
!./build/IconCreator/Release/*.pdb
secrets:
nugetUserName: ${{ vars.PRIVATE_NUGET_API_USERNAME }}
nugetToken: ${{ secrets.PRIVATE_NUGET_API_KEY }}

# Create release
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
permissions:
contents: write

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: IconCreator
path: IconCreator/

# Zip application files
- name: Zip artifact for deployment
run: zip Artifacts/IconCreator.zip IconCreator/** -r

# Get release labels
- name: Define release parameters
shell: pwsh
id: compute_parameters
run: |
if ('${{ needs.gitversion.outputs.suffix_label }}' -eq '') {
echo "release-display-name=${{ needs.gitversion.outputs.version }}" >> $Env:GITHUB_OUTPUT
echo "is-preview=false" >> $Env:GITHUB_OUTPUT
} else {
echo "is-preview=true" >> $Env:GITHUB_OUTPUT
if ('${{ needs.gitversion.outputs.suffix_label }}' -eq 'pre') {
echo "release-display-name='${{ needs.gitversion.outputs.version }} - Preview'" >> $Env:GITHUB_OUTPUT
} else if ('${{ needs.gitversion.outputs.suffix_label }}' -eq 'alpha') {
echo "release-display-name='${{ needs.gitversion.outputs.version }} - Alpha'" >> $Env:GITHUB_OUTPUT
} else if ('${{ needs.gitversion.outputs.suffix_label }}' -eq 'beta') {
echo "release-display-name='${{ needs.gitversion.outputs.version }} - Beta'" >> $Env:GITHUB_OUTPUT
}
}
# Create release
- uses: ncipollo/release-action@main # https://github.com/marketplace/actions/create-release
name: Create Release
with:
artifacts: "Artifacts/*.zip"
artifactErrorsFailBuild: true
draft: true
generateReleaseNotes: false
token: ${{ github.token }}
name: "${{ steps.compute_parameters.outputs.release-display-name }}"
prerelease: ${{ steps.compute_parameters.outputs.is-preview }}
tag: v${{needs.gitversion.outputs.full_version}}
body: ${{ steps.changelog.outputs.changes }}
36 changes: 36 additions & 0 deletions .github/workflows/git_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright (c) Stéphane ANDRE.
# Licensed under the MIT license.

name: Check Git Version

on:
workflow_dispatch:

jobs:

# GitVersion
gitversion:
runs-on: windows-latest

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
Loading

0 comments on commit 2249a7b

Please sign in to comment.