Skip to content

Commit 6ea21c9

Browse files
committed
Work CD-CI
- Fix PS that replaces the assembly declaration on class library build for a tag Signed-off-by: José Simões <[email protected]>
1 parent f759d28 commit 6ea21c9

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

commit-assemblyinfo-changes.ps1

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ if ($env:APPVEYOR_REPO_TAG -eq "true")
66
{
77
'Updating assembly version in nf-interpreter...' | Write-Host -ForegroundColor White -NoNewline
88

9+
# name of source file with the native declaration
10+
$nativeFile = "nanoFramework_hardware_esp32_native.cpp"
11+
12+
# find assembly declaration
13+
$assemblyDeclarationPath = (Get-ChildItem -Path ".\*" -Include $nativeFile -Recurse)
14+
$filecontent = Get-Content($assemblyDeclarationPath)
15+
$assemblyChecksum = $filecontent -match '(0x.{8})'
16+
$assemblyChecksum = $assemblyChecksum -replace "," , ""
17+
$assemblyChecksum = $assemblyChecksum -replace " " , ""
18+
919
# clone nf-interpreter repo (only a shallow clone with last commit)
1020
git clone https://github.com/nanoframework/nf-interpreter -b develop --depth 1 -q
1121
cd nf-interpreter > $null
@@ -21,10 +31,16 @@ if ($env:APPVEYOR_REPO_TAG -eq "true")
2131
$newVersion = "{ $newVersion }"
2232

2333
$versionRegex = "\{\s*\d+\,\s*\d+\,\s*\d+\,\s*\d+\s*}"
24-
$assemblyFiles = (Get-ChildItem -Path ".\*" -Include "nanoFramework_hardware_esp32_native.cpp" -Recurse)
34+
$assemblyFiles = (Get-ChildItem -Path ".\*" -Include $nativeFile -Recurse)
2535

2636
foreach($file in $assemblyFiles)
2737
{
38+
# replace checksum
39+
$filecontent = Get-Content($file)
40+
attrib $file -r
41+
$filecontent -replace "0x.{8}", $assemblyChecksum | Out-File $file -Encoding utf8
42+
43+
# replace version
2844
$filecontent = Get-Content($file)
2945
attrib $file -r
3046
$filecontent -replace $versionRegex, $newVersion | Out-File $file -Encoding utf8
@@ -48,7 +64,7 @@ if ($env:APPVEYOR_REPO_TAG -eq "true")
4864
git push --set-upstream origin "$newBranch" --porcelain -q > $null
4965

5066
# start PR
51-
$prRequestBody = @{title="$commitMessage";body="$commitMessage`nStarted with https://github.com/$env:APPVEYOR_REPO_NAME/commit/$env:APPVEYOR_REPO_COMMIT`n[version update]";head="$newBranch";base="develop"} | ConvertTo-Json
67+
$prRequestBody = @{title="$commitMessage";body="$commitMessage`n`nStarted from https://github.com/$env:APPVEYOR_REPO_NAME/commit/$env:APPVEYOR_REPO_COMMIT`n`n[version update]";head="$newBranch";base="develop"} | ConvertTo-Json
5268
$githubApiEndpoint = "https://api.github.com/repos/nanoframework/nf-interpreter/pulls"
5369
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
5470

0 commit comments

Comments
 (0)