Skip to content

Commit f095b7a

Browse files
committed
Work CI-CD
- Fix publish to Cloudsmith: need to adjust package name and versions to drop preview suffix.
1 parent d6ceb4e commit f095b7a

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

azure-pipelines-templates/publish-cloudsmith.yml

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ steps:
2222
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\$(TargetPublishName)'
2323
includeRootFolder: false
2424
archiveType: 'zip'
25-
archiveFile: '$(Agent.TempDirectory)\$(TargetPublishName)-$(NBGV_AssemblyVersion).zip'
25+
archiveFile: '$(Agent.TempDirectory)\$(TargetPublishName)-$(NBGV_SimpleVersion).$(TARGET_BUILD_COUNTER).zip'
2626
replaceExistingArchive: true
2727

2828
- task: CopyFiles@1
@@ -40,7 +40,7 @@ steps:
4040
inputs:
4141
sourceFolder: $(Agent.TempDirectory)
4242
Contents: |
43-
$(TargetPublishName)-$(NBGV_AssemblyVersion).zip
43+
$(TargetPublishName)-$(NBGV_SimpleVersion).$(TARGET_BUILD_COUNTER).zip
4444
TargetFolder: '$(Build.ArtifactStagingDirectory)\$(TargetPublishName)'
4545
flattenFolders: true
4646

@@ -51,7 +51,6 @@ steps:
5151
eq(variables['System.PullRequest.PullRequestId'], ''),
5252
or(
5353
eq(variables['ForceUpload'], true),
54-
startsWith(variables['Build.SourceBranchName'], 'main'),
5554
startsWith(variables['Build.SourceBranchName'], 'develop')
5655
)
5756
)
@@ -70,7 +69,6 @@ steps:
7069
eq(variables['System.PullRequest.PullRequestId'], ''),
7170
or(
7271
eq(variables['ForceUpload'], true),
73-
startsWith(variables['Build.SourceBranchName'], 'main'),
7472
startsWith(variables['Build.SourceBranchName'], 'develop')
7573
)
7674
)
@@ -97,13 +95,7 @@ steps:
9795
eq(variables['ForceUpload'], true),
9896
and(
9997
succeeded(),
100-
eq(variables['System.PullRequest.PullRequestId'], ''),
101-
or(
102-
eq(variables['Build.SourceBranchName'], 'develop'),
103-
eq(variables['Build.SourceBranchName'], 'main'),
104-
contains(variables['Build.SourceBranchName'], 'release'),
105-
eq(variables['Build.Repository.Name'], 'nanoframework/nf-Community-Targets')
106-
)
98+
eq(variables['System.PullRequest.PullRequestId'], '')
10799
)
108100
)
109101
displayName: Set Cloudsmith repo path
@@ -122,9 +114,9 @@ steps:
122114
# this is a build for a community target
123115
Write-Host "$("##vso[task.setvariable variable=CLOUDSMITH_REPO]")nanoframework-images-community-targets"
124116
# set publishing package name
125-
Write-Host "$("##vso[task.setvariable variable=PUBLISHING_PACKAGE_NAME]")$(TargetPublishName)-$(NBGV_AssemblyVersion)"
117+
Write-Host "$("##vso[task.setvariable variable=PUBLISHING_PACKAGE_NAME]")$(TargetPublishName)-$(NBGV_SimpleVersion).$(TARGET_BUILD_COUNTER)"
126118
# set version
127-
Write-Host "$("##vso[task.setvariable variable=PACKAGE_VERSION]")$(NBGV_AssemblyVersion)"
119+
Write-Host "$("##vso[task.setvariable variable=PACKAGE_VERSION]")$(NBGV_SimpleVersion).$(TARGET_BUILD_COUNTER)"
128120
}
129121
else
130122
{
@@ -143,9 +135,9 @@ steps:
143135
# this main branch, publish to Cloudsmith stable repo
144136
Write-Host "$("##vso[task.setvariable variable=CLOUDSMITH_REPO]")nanoframework-images"
145137
# set publishing package name
146-
Write-Host "$("##vso[task.setvariable variable=PUBLISHING_PACKAGE_NAME]")$(TargetPublishName)-$(NBGV_AssemblyVersion)"
138+
Write-Host "$("##vso[task.setvariable variable=PUBLISHING_PACKAGE_NAME]")$(TargetPublishName)-$(NBGV_SimpleVersion).$(TARGET_BUILD_COUNTER)"
147139
# set version
148-
Write-Host "$("##vso[task.setvariable variable=PACKAGE_VERSION]")$(NBGV_AssemblyVersion)"
140+
Write-Host "$("##vso[task.setvariable variable=PACKAGE_VERSION]")$(NBGV_SimpleVersion).$(TARGET_BUILD_COUNTER)"
149141
}
150142
}
151143
errorActionPreference: 'stop'
@@ -157,13 +149,7 @@ steps:
157149
eq(variables['ForceUpload'], true),
158150
and(
159151
succeeded(),
160-
eq(variables['System.PullRequest.PullRequestId'], ''),
161-
or(
162-
eq(variables['Build.SourceBranchName'], 'develop'),
163-
eq(variables['Build.SourceBranchName'], 'main'),
164-
contains(variables['Build.SourceBranchName'], 'release'),
165-
eq(variables['Build.Repository.Name'], 'nanoframework/nf-Community-Targets')
166-
)
152+
eq(variables['System.PullRequest.PullRequestId'], '')
167153
)
168154
)
169155
displayName: Upload package to Cloudsmith
@@ -172,9 +158,9 @@ steps:
172158
script: |
173159
174160
# install Cloudsmith CLI
175-
python -m pip install --upgrade cloudsmith-cli
161+
python -m pip install --upgrade cloudsmith-cli --quiet
176162
177-
Write-Host "Uploading $(PUBLISHING_PACKAGE_NAME) v$(PACKAGE_VERSION)"
163+
Write-Host "Uploading $(PUBLISHING_PACKAGE_NAME) to v$(PACKAGE_VERSION)"
178164
179165
cloudsmith push raw net-nanoframework/$(CLOUDSMITH_REPO) $(Agent.TempDirectory)\$(PUBLISHING_PACKAGE_NAME).zip --name $(TargetPublishName) --version $(PACKAGE_VERSION) --tags $(TargetPlatform),$(TargetSeries) --republish -k $(CLOUDSMITH_KEY)
180166

0 commit comments

Comments
 (0)