Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test build pipeline to publish to internal ADO #308

Merged
merged 10 commits into from
May 7, 2024
2 changes: 1 addition & 1 deletion .pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ steps:
MaxConcurrency: '50'
MaxRetryAttempts: '5'

- script: dotnet nuget push $(Build.SourcesDirectory)\out\packages\*.nupkg --api-key $(ADOAPIKEY) --timeout 1200 --source https://msazure.pkgs.visualstudio.com/_packaging/CRC-VC/nuget/v3/index.json --skip-duplicate
- script: $(Build.SourcesDirectory)\upload-packages-internal.cmd $(Build.SourcesDirectory)\out\packages $(ADOAPIKEY)
displayName: 'Publish NuGet to ADO Artifact Packages as temporary workaround to ADO lagging behind in package availability'

- script: $(Build.SourcesDirectory)\upload-packages.cmd $(Build.SourcesDirectory)\out\packages $(NUGETORGAPIKEY)
Expand Down
47 changes: 47 additions & 0 deletions upload-packages-internal.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@echo Off

if /i "%~1" == "/?" Goto :Usage
if /i "%~1" == "-?" Goto :Usage
if /i "%~1" == "--help" Goto :Usage
if /i "%~1" == "" Goto :Usage
if /i "%~2" == "" Goto :Usage

set ExitCode=0
set PackageDirectory=%~1

echo:
echo [Uploading NuGet Packages]
echo --------------------------------------------------
echo Package Directory : %PackageDirectory%
echo Feed : %FeedUri%
echo:

for %%f in (%PackageDirectory%\*.nupkg) do (
call dotnet nuget push %%f --api-key %~2 --timeout 1200 --source https://msazure.pkgs.visualstudio.com/_packaging/CRC-VC/nuget/v3/index.json --skip-duplicate %~3 && echo: || Goto :Error
)

Goto :End


:Usage
echo Invalid Usage.
echo Usage:
echo %~0 {packageDirectory} {nugetApiKey} [{dotnet push args}]
echo:
echo Examples:
echo %~0 S:\source\one\repo\out\bin\Release\x64\Packages apikey
echo %~0 S:\source\one\repo\out\bin\Release\x64\Packages apikey --interactive
Goto :End


:Error
set ExitCode=%ERRORLEVEL%


:End
rem Reset environment variables
set PackageDirectory=
set FeedUri=

echo Build Stage Exit/Error Code: %ExitCode%
exit /B %ExitCode%
Loading