Skip to content

Commit 49f643d

Browse files
committed
small fixes
1 parent 2fd786f commit 49f643d

1 file changed

Lines changed: 53 additions & 26 deletions

File tree

.github/workflows/dotnet.yml

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# TypeScript Definition Generator — VSIX and Rider plugin build
22
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
33

4-
name: .NET
4+
name: CI
55

66
on:
77
push:
@@ -14,11 +14,11 @@ on:
1414
pull_request:
1515
branches:
1616
- master
17-
workflow_dispatch:
17+
workflow_dispatch: # <-- вот это даёт ручной запуск
1818

1919
jobs:
2020
build:
21-
permissions:
21+
permissions: # <-- https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#defining-access-for-the-github_token-scopes
2222
contents: write
2323

2424
env:
@@ -34,6 +34,7 @@ jobs:
3434
- name: Checkout
3535
uses: actions/checkout@v4
3636
with:
37+
# Disabling shallow clones is recommended for improving the relevancy of reporting
3738
fetch-depth: 0
3839

3940
- name: Setup MSBuild
@@ -53,36 +54,64 @@ jobs:
5354
versionSpec: 5.12.0
5455

5556
- name: Determine Version
56-
id: gitversion
5757
uses: gittools/actions/gitversion/execute@v1.1.1
5858
with:
5959
useConfigFile: true
6060

61-
- name: Increment VSIX version
62-
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
63-
run: |
64-
$manifest = "src/TypeScriptDefinitionGenerator/source.extension.vsixmanifest"
65-
$csFile = "src/TypeScriptDefinitionGenerator/source.extension.cs"
66-
$newVersion = "${{ steps.gitversion.outputs.assemblySemFileVer }}"
67-
if ([string]::IsNullOrWhiteSpace($newVersion)) { $newVersion = "${{ steps.gitversion.outputs.majorMinorPatch }}.0" }
68-
$initialVersion = "2.2.0.0"
69-
[xml]$xml = Get-Content $manifest
70-
$ns = New-Object System.Xml.XmlNamespaceManager $xml.NameTable
71-
$ns.AddNamespace("ns", $xml.DocumentElement.NamespaceURI) | Out-Null
72-
$attr = $xml.SelectSingleNode("//ns:Identity", $ns).Attributes["Version"]
73-
$attr.Value = $newVersion
74-
$xml.Save($manifest)
75-
(Get-Content $csFile) -replace [regex]::Escape($initialVersion), $newVersion | Set-Content $csFile
76-
echo "VERSION=$newVersion" >> $env:GITHUB_ENV
77-
7861
- name: Restore
7962
run: msbuild $env:SOLUTION /t:restore /p:configuration=$env:BUILD_CONFIG /v:m
8063

64+
- name: Run tests
65+
run: dotnet test /p:Configuration=$BUILD_CONFIG --no-restore --no-build --verbosity normal
66+
67+
- name: SonarQube Scan
68+
uses: sonarsource/sonarcloud-github-action@v5 # Ex: v4.0.0, See the latest version at https://github.com/marketplace/actions/sonarcloud-scan
69+
with:
70+
# projectBaseDir: app/
71+
# args: >
72+
# -Dsonar.organization=peshkov
73+
# -Dsonar.projectKey=Cross.EdiEngine
74+
# -Dsonar.python.coverage.reportPaths=coverage.xml
75+
# -Dsonar.sources=Cross.EdiEngine/
76+
# -Dsonar.tests=tests/
77+
# -Dsonar.test.exclusions=tests/**
78+
# -Dsonar.verbose=true
79+
args: >
80+
-Dsonar.organization=peshkov
81+
-Dsonar.projectKey=Cross.EdiEngine
82+
-Dsonar.python.coverage.reportPaths=coverage.xml
83+
-Dsonar.sources=EdiEngine/
84+
-Dsonar.verbose=true
85+
env:
86+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
87+
8188
- name: Build VSIX
82-
run: msbuild $env:SOLUTION /t:TypeScriptDefinitionGenerator /p:configuration=$env:BUILD_CONFIG /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m
89+
run: >
90+
msbuild $env:SOLUTION \
91+
/t:TypeScriptDefinitionGenerator \
92+
/p:configuration=$env:BUILD_CONFIG \
93+
/p:DeployExtension=false \
94+
/p:ZipPackageCompressionLevel=normal \
95+
/v:m
8396
8497
- name: Build Rider plugin
85-
run: bash build-rider-plugin.sh $env:BUILD_CONFIG ${{ steps.gitversion.outputs.semVer }}
98+
run: bash build-rider-plugin.sh $env:BUILD_CONFIG ${GitVersion_InformationalVersion}
99+
100+
- name: ref
101+
run: echo "github.head_ref 1 ${{ github.head_ref }} 2 $GITHUB_REF 3 ${{ github.ref }}"
102+
103+
- name: Create git Tag
104+
if: ${{ contains('refs/heads/hotfix', github.ref) || contains('refs/heads/release', github.ref) || contains('refs/heads/master', github.ref) }}
105+
run: |
106+
git tag v${{ env.semVer }}
107+
108+
- name: Push git Tag
109+
if: ${{ contains(fromJson('["refs/heads/master", "refs/heads/release", "refs/heads/hotfix"]'), github.ref) }}
110+
run: |
111+
git config --global user.name 'Denis Peshkov'
112+
git config --global user.email 'denis.peshkov@outlook.com'
113+
git remote set-url origin https://x-access-token:${{ secrets.TAGTOKEN }}@github.com/${{ github.repository }}
114+
git push origin v${{ env.semVer }}
86115
87116
- name: Publish to VSIX Gallery
88117
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
@@ -109,9 +138,7 @@ jobs:
109138
New-Item -ItemType Directory -Path artifacts -Force
110139
$vsix = Get-ChildItem -Path . -Filter "*.vsix" -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.FullName -like "*TypeScriptDefinitionGenerator*" -and $_.FullName -notlike "*obj*" } | Select-Object -First 1
111140
if ($vsix) { Copy-Item $vsix.FullName -Destination "artifacts/TypeScriptDefinitionGenerator.vsix" -Force }
112-
$riderVer = "${{ steps.gitversion.outputs.semVer }}"
113-
$riderZip = "output/TypeScriptDefinitionGenerator.Rider-$riderVer.zip"
114-
if (Test-Path $riderZip) { Copy-Item $riderZip -Destination "artifacts/" -Force }
141+
if (Test-Path "output/TypeScriptDefinitionGenerator.Rider-${GitVersion_InformationalVersion}.zip") { Copy-Item "output/TypeScriptDefinitionGenerator.Rider-${GitVersion_InformationalVersion}.zip" -Destination "artifacts/" -Force }
115142
116143
- name: Upload artifacts
117144
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)