mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-29 15:19:44 +02:00
Add automatic local nuget config
CMake now automatically generates `nuget.config` with a read-only PAT Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
This commit is contained in:
parent
70eca6b9aa
commit
0f861b97b0
@ -144,6 +144,36 @@ if( VCPKG )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( NOT DEFINED ENV{CI} AND NOT EXISTS ${CMAKE_SOURCE_DIR}/nuget.config AND (EXISTS ${VCPKG_ROOT}/vcpkg OR EXISTS ${VCPKG_ROOT}/vcpkg.exe) )
|
||||
|
||||
execute_process(
|
||||
COMMAND vcpkg fetch nuget
|
||||
WORKING_DIRECTORY ${VCPKG_ROOT}
|
||||
OUTPUT_VARIABLE NUGET_EXECUTABLE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
message( STATUS "Automatically setting Nuget api key to allow nuget cache usage locally" )
|
||||
|
||||
file( READ ${CMAKE_SOURCE_DIR}/nuget.config.in NUGET_CONFIG_CONTENT )
|
||||
file( WRITE ${CMAKE_SOURCE_DIR}/nuget.config ${NUGET_CONFIG_CONTENT} )
|
||||
|
||||
set( GITHUB_PACKAGES_TOKEN_SUFFIX "ZdXoXftxDTV20UjAmIL2Mw95kckhbo0hmiYz" )
|
||||
|
||||
execute_process(
|
||||
COMMAND "${NUGET_EXECUTABLE}" sources add -Name tenacityteam_github_auto -Source https://nuget.pkg.github.com/tenacityteam/index.json -Config nuget.config -Username tenacityteamci -Password ghp_${GITHUB_PACKAGES_TOKEN_SUFFIX} -StorePasswordInClearText -ForceEnglishOutput -NonInteractive
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND "${NUGET_EXECUTABLE}" setapikey -Source tenacityteam_github_auto -Config nuget.config ghp_${GITHUB_PACKAGES_TOKEN_SUFFIX}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE SETAPI_KEY_RESULT
|
||||
ERROR_VARIABLE SETAPI_KEY_RESULT
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
if( NOT DEFINED VCPKG_OVERLAY_PORTS )
|
||||
set( VCPKG_OVERLAY_PORTS "${VCPKG_ROOT}/overlay/ports" )
|
||||
endif()
|
||||
|
6
nuget.config.in
Normal file
6
nuget.config.in
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key="defaultPushSource" value="https://nuget.pkg.github.com/tenacityteam/index.json"/>
|
||||
</config>
|
||||
</configuration>
|
Loading…
x
Reference in New Issue
Block a user