Skip to content

Commit

Permalink
Merge pull request #8 from Lombiq/issue/OSOE-86
Browse files Browse the repository at this point in the history
OSOE-86: Automate Orchard Core extension manifest version number update during NuGet publish
  • Loading branch information
sarahelsaig authored Jun 7, 2022
2 parents 50ee75f + 1840659 commit f848747
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,43 @@ jobs:
}
program Microsoft.SourceLink.GitHub
- name: Update package manifest version
shell: pwsh
run: |
function Program {
param(
[string]
$WorkDir,
[string]
$PackageVersion
)
function Update-Manifest-Version {
param(
[string]
$Manifest,
[string]
$Version
)
(Get-Content -Raw $Manifest) -replace
'(?<head>\[assembly:\s*Module\(([^\]]*Version\W*=\W*"))([^"]*)', "`${head}$Version" |
Out-File $Manifest
Write-Output "Version updated in $Manifest to $Version"
}
$manifests = Get-ChildItem $WorkDir -File -Recurse -Filter "Manifest.cs" |
Select-String -List -Pattern 'OrchardCore.Modules.Manifest' |
Select-Object -ExpandProperty Path
foreach ($manifest in $manifests) {
Update-Manifest-Version $manifest $PackageVersion
}
}
Program './' '${{ steps.get_version.outputs.VERSION }}'
- name: Install dependencies
run: dotnet restore -p:NuGetBuild=true --verbosity ${{ inputs.verbosity }}

Expand Down
33 changes: 33 additions & 0 deletions scripts/manifest-version.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
function Program {
param(
[string]
$WorkDir,
[string]
$PackageVersion
)

function Update-Manifest-Version {
param(
[string]
$Manifest,
[string]
$Version
)

(Get-Content -Raw $Manifest) -replace
'(?<head>\[assembly:\s*Module\(([^\]]*Version\W*=\W*"))([^"]*)', "`${head}$Version" |
Out-File $Manifest

Write-Output "Version updated in $Manifest to $Version"
}

$manifests = Get-ChildItem $WorkDir -File -Recurse -Filter "Manifest.cs" |
Select-String -List -Pattern 'OrchardCore.Modules.Manifest' |
Select-Object -ExpandProperty Path

foreach ($manifest in $manifests) {
Update-Manifest-Version $manifest $PackageVersion
}
}

Program $args[0] $args[1]

0 comments on commit f848747

Please sign in to comment.