Skip to content

Commit

Permalink
Update the github action, do not try to get lastest package version f…
Browse files Browse the repository at this point in the history
…rom gallery.
  • Loading branch information
inversionhourglass committed Sep 18, 2024
1 parent 58f3293 commit d6cbd96
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 98 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/publish-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,59 +29,6 @@ jobs:

- name: Restore NuGets
run: dotnet restore ${{ env.SOLUTION }}

- name: Abstractions Version Setup
run: |
function Gallery-Version {
param (
[string]$packageName
)
# 从nuget.org获取最新版本号
$pattern = "^> $packageName \| (\S+) "
$packages = nuget search $packageName -PreRelease
foreach ($pkg in $packages) {
if ($pkg -match $pattern) {
$latestVersion = $matches[1]
}
}
if ($latestVersion -eq $null) {
$packages = nuget search $packageName
foreach ($pkg in $packages) {
if ($pkg -match $pattern) {
$latestVersion = $matches[1]
}
}
}
if ($latestVersion -eq $null) {
throw "Cannot get the latest version of $packageName from nuget.org"
}
echo "The latest version of $packageName is $latestVersion"
# 修改项目文件版本号
$xmlPath = "src/$packageName/$packageName.csproj"
[xml]$xmlDoc = Get-Content $xmlPath
$propertyGroup = $xmlDoc.Project.PropertyGroup
$versionPrefixNode = $propertyGroup.SelectSingleNode("VersionPrefix")
$newVersionNode = $xmlDoc.CreateElement("Version")
$newVersionNode.InnerText = $latestVersion
$propertyGroup.RemoveChild($versionPrefixNode)
$propertyGroup.AppendChild($newVersionNode)
$xmlDoc.Save($xmlPath)
}
$branchName = "${{ github.ref_name }}"
if ($branchName -ne "pre/basic") {
Gallery-Version -packageName "DependencyInjection.StaticAccessor"
if ($branchName -ne "pre/hosting") {
Gallery-Version -packageName "DependencyInjection.StaticAccessor.Hosting"
if ($branchName -ne "pre/blazor") {
Gallery-Version -packageName "DependencyInjection.StaticAccessor.Blazor"
}
}
}

- name: Build Solution
run: dotnet build --configuration Release --no-restore ${{ env.SOLUTION }} --version-suffix preview-${{ env.TIMESTAMP }}
Expand Down
45 changes: 0 additions & 45 deletions .github/workflows/publish-release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,51 +28,6 @@ jobs:
- name: Restore NuGets
run: dotnet restore ${{ env.SOLUTION }}

- name: Abstractions Version Setup
run: |
function Gallery-Version {
param (
[string]$packageName
)
# 从nuget.org获取最新版本号
$pattern = "^> $packageName \| (\S+) "
$packages = nuget search $packageName
foreach ($pkg in $packages) {
if ($pkg -match $pattern) {
$latestVersion = $matches[1]
}
}
if ($latestVersion -eq $null) {
throw "Cannot get the latest version of $packageName from nuget.org"
}
echo "The latest version of $packageName is $latestVersion"
# 修改项目文件版本号
$xmlPath = "src/$packageName/$packageName.csproj"
[xml]$xmlDoc = Get-Content $xmlPath
$propertyGroup = $xmlDoc.Project.PropertyGroup
$versionPrefixNode = $propertyGroup.SelectSingleNode("VersionPrefix")
$newVersionNode = $xmlDoc.CreateElement("Version")
$newVersionNode.InnerText = $latestVersion
$propertyGroup.RemoveChild($versionPrefixNode)
$propertyGroup.AppendChild($newVersionNode)
$xmlDoc.Save($xmlPath)
}
$tagName = "${{ github.ref_name }}"
if ($tagName -notlike "basic-*") {
Gallery-Version -packageName "DependencyInjection.StaticAccessor"
if ($tagName -notlike "hosting-*") {
Gallery-Version -packageName "DependencyInjection.StaticAccessor.Hosting"
if ($tagName -notlike "blazor-*") {
Gallery-Version -packageName "DependencyInjection.StaticAccessor.Blazor"
}
}
}
- name: Build Solution
run: dotnet build --configuration Release --no-restore ${{ env.SOLUTION }}

Expand Down

0 comments on commit d6cbd96

Please sign in to comment.