Skip to content

Commit

Permalink
Some random code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahelsaig committed Jul 2, 2022
1 parent 9aedbb3 commit a825d3a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
22 changes: 5 additions & 17 deletions .github/actions/publish-nuget/Update-ManifestVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,16 @@
[string]
$WorkDir,
[string]
$PackageVersion
$Version
)

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

(Get-Content -Raw $Manifest) -replace
'(?<head>\[assembly:\s*(Module|Theme)\(([^\]]*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|OrchardCore.DisplayManagement.Manifest)' |
Select-Object -ExpandProperty Path

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

Write-Output "Version updated in $manifest to $Version"
}
2 changes: 1 addition & 1 deletion .github/actions/publish-nuget/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ runs:

- name: Update package manifest version
shell: pwsh
run: Update-ManifestVersion './' '${{ steps.setup.outputs.publish-version }}'
run: Update-ManifestVersion $PWD '${{ steps.setup.outputs.publish-version }}'

- name: Enable Node corepack
uses: Lombiq/GitHub-Actions/.github/actions/enable-corepack@dev
Expand Down

0 comments on commit a825d3a

Please sign in to comment.