diff --git a/Build/PublishPackage.ps1 b/Build/PublishPackage.ps1 new file mode 100644 index 0000000..c6e062d --- /dev/null +++ b/Build/PublishPackage.ps1 @@ -0,0 +1,17 @@ +param ( + $SolutionRoot = "$PSScriptRoot\.." +) + +$NugetAPI = Get-Content -Raw -LiteralPath "C:\Support\Important\NugetOrg.txt" +#$GitHubAPI = Get-Content -Raw -LiteralPath "C:\Support\Important\GithubAPI.txt" + +$ReleasePath = [io.path]::Combine($SolutionRoot, "OfficeIMO.Word", "bin", "Release") +$File = Get-ChildItem -Path $ReleasePath -Recurse -Filter "*.nupkg" + +# publish to nuget.org +if ($File.Count -eq 1) { + dotnet nuget push $File.FullName --api-key $NugetAPI --source https://api.nuget.org/v3/index.json + + #dotnet nuget add source --username evotecit --password $GitHubAPI --store-password-in-clear-text --name github "https://nuget.pkg.github.com/OWNER/index.json" + #dotnet nuget push $File.FullName --api-key $GitHubAPI --source "github" +} \ No newline at end of file diff --git a/Build/UploadGithub.ps1 b/Build/UploadGithub.ps1 new file mode 100644 index 0000000..bd32e15 --- /dev/null +++ b/Build/UploadGithub.ps1 @@ -0,0 +1,36 @@ +param ( + $SolutionRoot = "$PSScriptRoot\.." +) + +$GitHubAccessToken = Get-Content -Raw 'C:\Support\Important\GithubAPI.txt' +$UserName = 'EvotecIT' +$GitHubRepositoryName = 'OfficeIMO' + +$SolutionPath = [io.path]::Combine($SolutionRoot, 'OfficeImo.sln') +if (-not $SolutionRoot -or -not (Test-Path -Path $SolutionPath)) { + Write-Host -Object "Solution not found at $SolutionPath" -ForegroundColor Red + return +} + +$ProjectPath = [io.path]::Combine($SolutionRoot, "OfficeIMO.Word", "OfficeIMO.Word.csproj") + +[xml] $XML = Get-Content -Raw $ProjectPath + +$Version = $XML.Project.PropertyGroup[0].VersionPrefix + +$ZipPath = [io.path]::Combine($SolutionRoot, "OfficeIMO.Word", "bin", "Release", "OfficeIMO.Word.$Version.zip") +$IsPreRelease = $false +$TagName = "v$Version" + +if (Test-Path -LiteralPath $ZipPath) { + $sendGitHubReleaseSplat = @{ + GitHubUsername = $UserName + GitHubRepositoryName = $GitHubRepositoryName + GitHubAccessToken = $GitHubAccessToken + TagName = $TagName + AssetFilePaths = $ZipPath + IsPreRelease = $IsPreRelease + } + $StatusGithub = Send-GitHubRelease @sendGitHubReleaseSplat + $StatusGithub +} \ No newline at end of file