@@ -6,6 +6,8 @@ SDK_VERSION := $(shell cd pulumi-language-dotnet && sed -n 's/^.*github\.com\/pu
66
77GO_TEST_FILTER_FLAG := $(if $(TEST_FILTER ) ,-run $(TEST_FILTER ) )
88DOTNET_TEST_FILTER_FLAG := $(if $(TEST_FILTER ) ,--filter $(TEST_FILTER ) )
9+ RELEASE_VERSION_FLAG := $(if $(PULUMI_VERSION ) ,-p:Version=$(PULUMI_VERSION ) )
10+
911
1012.PHONY : install
1113install :
@@ -17,7 +19,7 @@ build: build_sdk build_language_host
1719
1820.PHONY : build_sdk
1921build_sdk :
20- cd sdk && dotnet build --configuration Release -p:PulumiSdkVersion=$(SDK_VERSION )
22+ cd sdk && dotnet build --configuration Release -p:PulumiSdkVersion=$(SDK_VERSION ) $( RELEASE_VERSION_FLAG )
2123
2224.PHONY : build_language_host
2325build_language_host :
@@ -98,6 +100,25 @@ lint_integration_tests: format_integration_tests_check
98100lint_integration_tests_fix : format_integration_tests
99101 cd integration_tests && golangci-lint run $(GOLANGCI_LINT_ARGS ) --fix --config ../.golangci.yml --timeout 5m --path-prefix integration_tests
100102
103+ .PHONY : publish
104+ publish : check_publish_credentials build
105+ $(MAKE ) publish_package PACKAGE=Pulumi
106+ $(MAKE ) publish_package PACKAGE=Pulumi.Automation
107+ $(MAKE ) publish_package PACKAGE=Pulumi.FSharp
108+
109+ .PHONY : publish_package
110+ publish_package : check_publish_credentials build
111+ if nuget list $( PACKAGE) -AllVersions | grep -q ' ^$(PACKAGE) $(PULUMI_VERSION)$$' ; then \
112+ echo " $( PACKAGE) $( PULUMI_VERSION) already published, skipping..." ; \
113+ exit 0; \
114+ else \
115+ cd sdk/$(PACKAGE ) ; \
116+ PKG_FILE=$$(ls bin/Release/*.nupkg | head -n1 ) ; \
117+ dotnet nuget push $$ PKG_FILE \
118+ -s https://api.nuget.org/v3/index.json \
119+ -k $(NUGET_PUBLISH_KEY ) ; \
120+ fi
121+
101122.PHONY : test
102123test : test_conformance test_integration test_sdk test_sdk_automation
103124
@@ -139,3 +160,13 @@ test_sdk_automation_coverage: clean
139160 -p:CollectCoverage=true \
140161 -p:CoverletOutputFormat=cobertura \
141162 -p:CoverletOutput=./coverage/coverage.pulumi.automation.xml
163+
164+ .PHONY : check_publish_credentials
165+ check_publish_credentials :
166+ if [ -z " $$ NUGET_PUBLISH_KEY" ]; then \
167+ echo " Missing NUGET_PUBLISH_KEY" && exit 1; \
168+ fi
169+ if [ -z " $$ PULUMI_VERSION" ]; then \
170+ echo " Missing PULUMI_VERSION" && exit 1; \
171+ fi
172+
0 commit comments