@@ -73,4 +73,46 @@ extends:
7373 env:
7474 GH_TOKEN: $(GH_TOKEN)
7575
76+ # Check whether this version is already published to all registries.
77+ # Sets needsPublishing=true if any of npm, NuGet, or crates.io do not
78+ # yet carry the version — so a partial publish still reruns the template.
79+ # The 'v' prefix is stripped from the release tag since registries
80+ # expect a bare version number e.g. 1.2.3 not v1.2.3.
81+ - script : |
82+ VERSION="$(releaseTag)"
83+ VERSION="${VERSION#v}"
84+ NEEDS_PUBLISHING=false
85+
86+ # npm
87+ if npm view "@microsoft/webui@${VERSION}" version 2>/dev/null | grep -q "^${VERSION}$"; then
88+ echo "npm @microsoft/webui@${VERSION} already published"
89+ else
90+ echo "npm @microsoft/webui@${VERSION} not yet published"
91+ NEEDS_PUBLISHING=true
92+ fi
93+
94+ # NuGet
95+ NUGET_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
96+ "https://api.nuget.org/v3-flatcontainer/microsoft.webui/${VERSION}/microsoft.webui.${VERSION}.nupkg")
97+ if [ "$NUGET_STATUS" = "200" ]; then
98+ echo "NuGet Microsoft.WebUI ${VERSION} already published"
99+ else
100+ echo "NuGet Microsoft.WebUI ${VERSION} not yet published (HTTP ${NUGET_STATUS})"
101+ NEEDS_PUBLISHING=true
102+ fi
103+
104+ # crates.io
105+ CRATE_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
106+ "https://crates.io/api/v1/crates/microsoft-webui/${VERSION}")
107+ if [ "$CRATE_STATUS" = "200" ]; then
108+ echo "crates.io microsoft-webui ${VERSION} already published"
109+ else
110+ echo "crates.io microsoft-webui ${VERSION} not yet published (HTTP ${CRATE_STATUS})"
111+ NEEDS_PUBLISHING=true
112+ fi
113+
114+ echo "##vso[task.setvariable variable=needsPublishing]${NEEDS_PUBLISHING}"
115+ displayName: Check if already published
116+
76117 - template : WebUI.Release.PipelineTemplate.yml@webuiPipelines # Template reference
118+ condition : eq(variables['needsPublishing'], 'true')
0 commit comments