Skip to content

Commit d34c737

Browse files
committed
small fixes
1 parent 71f9808 commit d34c737

1 file changed

Lines changed: 124 additions & 0 deletions

File tree

.github/workflows/dotnet.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: .NET
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
- dev
11+
- hotfix/*
12+
- release/*
13+
- feature/*
14+
pull_request:
15+
branches:
16+
- master
17+
workflow_dispatch: # <-- вот это даёт ручной запуск
18+
19+
jobs:
20+
build:
21+
permissions: # <-- https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#defining-access-for-the-github_token-scopes
22+
contents: write
23+
24+
env:
25+
BUILD_CONFIG: 'Release'
26+
SOLUTION: 'Cross.EdiEngine.sln'
27+
28+
runs-on: ubuntu-22.04 # ubuntu-latest
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
# Disabling shallow clones is recommended for improving the relevancy of reporting
35+
fetch-depth: 0
36+
37+
- name: Setup .NET
38+
uses: actions/setup-dotnet@v4
39+
with:
40+
dotnet-version: |
41+
6.0.x
42+
7.0.x
43+
8.0.x
44+
9.0.x
45+
10.0.x
46+
47+
- name: Setup NuGet
48+
uses: NuGet/setup-nuget@v2.0.0
49+
50+
- name: Install GitVersion
51+
uses: gittools/actions/gitversion/setup@v1.1.1
52+
with:
53+
versionSpec: 5.12.0
54+
55+
- name: Determine Version
56+
uses: gittools/actions/gitversion/execute@v1.1.1
57+
with:
58+
useConfigFile: true
59+
60+
- name: Restore dependencies
61+
run: dotnet restore
62+
63+
- name: Build
64+
run: |
65+
dotnet build "$SOLUTION" --configuration "$BUILD_CONFIG" --no-restore \
66+
-p:Configuration=$BUILD_CONFIG \
67+
-p:Version=${GitVersion_SemVer} \
68+
-p:AssemblyVersion=${GitVersion_AssemblySemVer} \
69+
-p:FileVersion=${GitVersion_AssemblySemFileVer} \
70+
-p:InformationalVersion="${GitVersion_InformationalVersion}" \
71+
-p:Company="Denis Peshkov" \
72+
-p:Product="Cross.EdiEngine" \
73+
-p:Description="Cross.EdiEngine: Simple .NET EDI Reader and Writer and Validator. Read and Write and Validate X12 EDI files with simple EDI Parser written on C#. Published on Nuget at https://www.nuget.org/packages/Cross.EdiEngine" \
74+
-p:RepositoryUrl="https://github.com/denis-peshkov/Cross.EdiEngine.git" \
75+
-p:RepositoryType=git \
76+
-p:CLSCompliant=true \
77+
-p:NeutralLanguage=en
78+
79+
- name: Run tests
80+
run: dotnet test /p:Configuration=$BUILD_CONFIG --no-restore --no-build --verbosity normal
81+
82+
- name: SonarQube Scan
83+
uses: sonarsource/sonarcloud-github-action@v5 # Ex: v4.0.0, See the latest version at https://github.com/marketplace/actions/sonarcloud-scan
84+
with:
85+
# projectBaseDir: app/
86+
# args: >
87+
# -Dsonar.organization=peshkov
88+
# -Dsonar.projectKey=Cross.EdiEngine
89+
# -Dsonar.python.coverage.reportPaths=coverage.xml
90+
# -Dsonar.sources=Cross.EdiEngine/
91+
# -Dsonar.tests=tests/
92+
# -Dsonar.test.exclusions=tests/**
93+
# -Dsonar.verbose=true
94+
args: >
95+
-Dsonar.organization=peshkov
96+
-Dsonar.projectKey=Cross.EdiEngine
97+
-Dsonar.python.coverage.reportPaths=coverage.xml
98+
-Dsonar.sources=EdiEngine/
99+
-Dsonar.verbose=true
100+
env:
101+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
102+
103+
- name: Nuget Pack
104+
run: nuget pack _nuget/config.nuspec -Symbols -Version ${{ env.semVer }}
105+
106+
- name: ref
107+
run: echo "github.head_ref 1 ${{ github.head_ref }} 2 $GITHUB_REF 3 ${{ github.ref }}"
108+
109+
- name: Create git Tag
110+
if: ${{ contains('refs/heads/hotfix', github.ref) || contains('refs/heads/release', github.ref) || contains('refs/heads/master', github.ref) }}
111+
run: |
112+
git tag v${{ env.semVer }}
113+
114+
- name: Push git Tag
115+
if: ${{ contains(fromJson('["refs/heads/master", "refs/heads/release", "refs/heads/hotfix"]'), github.ref) }}
116+
run: |
117+
git config --global user.name 'Denis Peshkov'
118+
git config --global user.email 'denis.peshkov@outlook.com'
119+
git remote set-url origin https://x-access-token:${{ secrets.TAGTOKEN }}@github.com/${{ github.repository }}
120+
git push origin v${{ env.semVer }}
121+
122+
- name: Nuget Push
123+
if: ${{ !startsWith(github.ref, 'refs/pull') }}
124+
run: nuget push **/Cross.EdiEngine.${{ env.semVer }}.symbols.nupkg -ApiKey ${{ secrets.NUGET_API_KEY }} -Source "https://api.nuget.org/v3/index.json" -SkipDuplicate

0 commit comments

Comments
 (0)