Skip to content

Commit

Permalink
Hotfix/fix pipeline (#5)
Browse files Browse the repository at this point in the history
* add autobuild/push Nuget packets
  • Loading branch information
denis-peshkov committed May 15, 2024
1 parent 785f04f commit bd4d9e5
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 51 deletions.
119 changes: 69 additions & 50 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,83 @@ name: .NET

on:
push:
branches:
- master
branches:
- master
- dev
- hotfix/*
- release/*
- feature/*
pull_request:
branches:
- master
branches:
- master

jobs:
build:

env:
BUILD_CONFIG: 'Release'
SOLUTION: 'Cross.CQRS.sln'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Setup NuGet
uses: NuGet/[email protected]

- name: Restore dependencies
run: dotnet restore

- name: Restore dependencies with NuGet
run: nuget restore $SOLUTION

- name: Build
run: dotnet build --no-restore

- name: Build 2
run: dotnet build $SOLUTION --configuration $BUILD_CONFIG --no-restore

- name: Test
run: dotnet test --no-build --verbosity normal

- name: Run tests
run: dotnet test /p:Configuration=$BUILD_CONFIG --no-restore --no-build --verbosity normal


















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

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Setup NuGet
uses: NuGet/[email protected]

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.12.0

- name: Determine Version
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true

- name: Restore dependencies
run: dotnet restore

- name: Restore dependencies with NuGet
run: nuget restore $SOLUTION

- name: Build
run: dotnet build $SOLUTION --configuration $BUILD_CONFIG --no-restore

- name: Nuget Pack
run: nuget pack _nuget/config.nuspec -Symbols -Version ${{ env.semVer }}

- name: ref
run: echo "github.head_ref 1 ${{ github.head_ref }} 2 $GITHUB_REF 3 ${{ github.ref }}"

- name: Create git Tag
if: ${{ contains('refs/heads/hotfix', github.ref) || contains('refs/heads/hotfix', github.ref) || contains('refs/heads/master', github.ref) }}
run: |
git tag v${{ env.semVer }}
- name: Push git Tag
if: ${{ contains(fromJson('["refs/heads/master", "refs/heads/release", "refs/heads/hotfix"]'), github.ref) }}
run: |
git config --global user.name 'Denis Peshkov'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.TAGTOKEN }}@github.com/${{ github.repository }}
git push origin v${{ env.semVer }}
- name: Nuget Push
if: ${{ !startsWith(github.ref, 'refs/pull') }}
run: nuget push **/Cross.CQRS.${{ env.semVer }}.symbols.nupkg -ApiKey ${{ secrets.NUGET_API_KEY }} -Source "https://api.nuget.org/v3/index.json" -SkipDuplicate

- name: Test
run: dotnet test --no-build --verbosity normal

- name: Run tests
run: dotnet test /p:Configuration=$BUILD_CONFIG --no-restore --no-build --verbosity normal
8 changes: 7 additions & 1 deletion Cross.CQRS.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ VisualStudioVersion = 17.3.32825.248
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3AF739CD-81D8-428D-A08A-0A58372DEBF6}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
.gitignore = .gitignore
LICENSE = LICENSE
README.md = README.md
ReleaseNotes.txt = ReleaseNotes.txt
GitVersion.yml = GitVersion.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cross.CQRS", "Cross.CQRS\Cross.CQRS.csproj", "{EAF0AC39-A26A-4432-8EA0-F1C9C01E3B06}"
Expand All @@ -22,6 +23,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_nuget", "_nuget", "{19139C
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleWebApp", "SampleWebApp\SampleWebApp.csproj", "{3433E255-17DF-4142-9507-7E34449947C0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{3EBFC25E-DB45-497A-BCD5-855A3222E3C0}"
ProjectSection(SolutionItems) = preProject
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
80 changes: 80 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
next-version: 7.0.0 #
branches:
master:
regex: ^master$|^main$
mode: ContinuousDelivery
tag: ''
increment: Inherit
source-branches:
- feature
- hotfix
- release
prevent-increment-of-merged-branch-version: false
track-merge-target: true
tracks-release-branches: true
is-release-branch: true
pre-release-weight: 0
release:
regex: ^release(s)?[/-]
mode: ContinuousDelivery
tag: preview
tag-number-pattern: '[/-](?<number>\d+)[-/]'
increment: Minor
source-branches:
- master
- dev
- release
prevent-increment-of-merged-branch-version: false
track-merge-target: true
tracks-release-branches: true
is-release-branch: true
pre-release-weight: 30000
hotfix:
regex: ^hotfix(es)?[/-]
mode: ContinuousDelivery
tag: preview
tag-number-pattern: '[/-](?<number>\d+)[-/]'
increment: Patch
source-branches: [ master, hotfix ]
prevent-increment-of-merged-branch-version: false
track-merge-target: true
tracks-release-branches: true
is-release-branch: true
pre-release-weight: 30000
feature:
regex: ^feature(s)?[/-]
mode: ContinuousDelivery
tag: useBranchName
increment: Inherit
prevent-increment-of-merged-branch-version: false
track-merge-target: false
tracks-release-branches: false
is-release-branch: false
pull-request:
regex: ^(pull|pull\-requests|pr|merge)[/-]
mode: ContinuousDelivery
tag: pr
tag-number-pattern: '[/-](?<number>\d+)[-/]'
increment: None
source-branches:
- dev
- master
- release
- feature
- support
- hotfix
prevent-increment-of-merged-branch-version: false
track-merge-target: false
tracks-release-branches: false
is-release-branch: false
dev:
regex: ^dev(elop)?(ment)?$
mode: ContinuousDeployment
tag: dev
increment: Minor
source-branches: [ master ]
prevent-increment-of-merged-branch-version: false
track-merge-target: true
tracks-release-branches: true
is-release-branch: false
pre-release-weight: 40000

0 comments on commit bd4d9e5

Please sign in to comment.