Skip to content

Commit 74a7b5d

Browse files
authored
Merge pull request #2018 from microsoft/fix/ci-hidi-gh-upload-to-v1
fix/ci hidi gh upload to v1
2 parents 6fea0e1 + e352fd3 commit 74a7b5d

File tree

2 files changed

+47
-63
lines changed

2 files changed

+47
-63
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -213,41 +213,13 @@ extends:
213213
pool:
214214
vmImage: ubuntu-latest
215215
steps:
216-
- pwsh: |
217-
$artifactName = Get-ChildItem -Path $(Pipeline.Workspace)\Nugets -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1
218-
$artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", ""
219-
#Set Variable $artifactName and $artifactVersion
220-
Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false; isOutput=true]$artifactVersion"
221-
Write-Host "##vso[task.setvariable variable=artifactName; isSecret=false; isOutput=true]$artifactName.FullName"
222-
echo "$artifactName"
223-
echo "$artifactVersion"
224-
displayName: 'Fetch Artifact Name'
225216
- task: 1ES.PublishNuget@1
226217
displayName: 'NuGet push'
227218
inputs:
228219
packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Hidi.*.nupkg'
229220
packageParentPath: '$(Pipeline.Workspace)'
230221
nuGetFeedType: external
231222
publishFeedCredentials: 'OpenAPI Nuget Connection'
232-
- task: GitHubRelease@1
233-
displayName: 'GitHub release (edit)'
234-
condition: succeededOrFailed()
235-
inputs:
236-
gitHubConnection: 'Github-MaggieKimani1'
237-
action: edit
238-
tagSource: userSpecifiedTag
239-
tag: '$(artifactVersion)'
240-
title: '$(artifactVersion)'
241-
releaseNotesSource: inline
242-
assets: '$(Pipeline.Workspace)\**\*.exe'
243-
changeLogType: issueBased
244-
changeLogLabels: '[
245-
{ "label" : "feature-work", "feature", "displayName" : "New Features", "state" : "closed" },
246-
{ "label" : "enhancement", "V2-Enhancement", "displayName" : "Enhancements", "state" : "closed" },
247-
{ "label" : "bug", "bug-fix", "displayName" : "Bugs", "state" : "closed" },
248-
{ "label" : "documentation", "doc", "displayName" : "Documentation", "state" : "closed"},
249-
{ "label" : "dependencies", "displayName" : "Package Updates", "state" : "closed" }
250-
]'
251223

252224
- deployment: deploy_lib
253225
templateContext:
@@ -303,4 +275,49 @@ extends:
303275
packagesToPush: '$(Pipeline.Workspace)/Nugets/Microsoft.OpenApi.Readers.*.nupkg'
304276
packageParentPath: '$(Pipeline.Workspace)'
305277
nuGetFeedType: external
306-
publishFeedCredentials: 'OpenAPI Nuget Connection'
278+
publishFeedCredentials: 'OpenAPI Nuget Connection'
279+
280+
- deployment: create_github_release
281+
templateContext:
282+
type: releaseJob
283+
isProduction: true
284+
inputs:
285+
- input: pipelineArtifact
286+
artifactName: Nugets
287+
targetPath: '$(Pipeline.Workspace)'
288+
dependsOn: []
289+
environment: kiota-github-releases
290+
strategy:
291+
runOnce:
292+
deploy:
293+
pool:
294+
vmImage: ubuntu-latest
295+
steps:
296+
- pwsh: |
297+
$artifactName = Get-ChildItem -Path $(Pipeline.Workspace)\Nugets -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1
298+
$artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", ""
299+
#Set Variable $artifactName and $artifactVersion
300+
Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false; isOutput=true]$artifactVersion"
301+
echo "$artifactVersion"
302+
displayName: 'Fetch Artifact Name'
303+
name: getTagVersion
304+
- task: GitHubRelease@1
305+
displayName: 'GitHub release (edit)'
306+
condition: succeededOrFailed()
307+
inputs:
308+
gitHubConnection: 'Github-MaggieKimani1'
309+
action: create
310+
tagSource: userSpecifiedTag
311+
tag: '$(getTagVersion.artifactVersion)'
312+
title: '$(getTagVersion.artifactVersion)'
313+
releaseNotesSource: inline
314+
assets: '$(Pipeline.Workspace)\**\*.exe'
315+
changeLogType: issueBased
316+
changeLogLabels: '[
317+
{ "label" : "feature-work", "feature", "displayName" : "New Features", "state" : "closed" },
318+
{ "label" : "enhancement", "V2-Enhancement", "displayName" : "Enhancements", "state" : "closed" },
319+
{ "label" : "bug", "bug-fix", "displayName" : "Bugs", "state" : "closed" },
320+
{ "label" : "documentation", "doc", "displayName" : "Documentation", "state" : "closed"},
321+
{ "label" : "dependencies", "displayName" : "Package Updates", "state" : "closed" }
322+
]'
323+

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ name: CI/CD Pipeline
33
on: [push, pull_request, workflow_dispatch]
44

55
permissions:
6-
contents: write
6+
contents: read
77

88
jobs:
99
ci:
1010
name: Continuous Integration
1111
runs-on: ubuntu-latest
12-
outputs:
13-
latest_version: ${{ steps.tag_generator.outputs.new_version }}
14-
is_default_branch: ${{ steps.conditionals_handler.outputs.is_default_branch }}
1512
env:
1613
ARTIFACTS_FOLDER: ${{ github.workspace }}/Artifacts
1714
GITHUB_RUN_NUMBER: ${{ github.run_number }}
@@ -21,43 +18,13 @@ jobs:
2118
with:
2219
dotnet-version: 8.0.x
2320

24-
- name: Data gatherer
25-
id: data_gatherer
26-
shell: pwsh
27-
run: |
28-
# Get default branch
29-
$repo = 'microsoft/OpenAPI.NET'
30-
$defaultBranch = Invoke-RestMethod -Method GET -Uri https://api.github.com/repos/$repo | Select-Object -ExpandProperty default_branch
31-
Write-Output "::set-output name=default_branch::$(echo $defaultBranch)"
32-
33-
- name: Conditionals handler
34-
id: conditionals_handler
35-
shell: pwsh
36-
run: |
37-
$defaultBranch = "${{ steps.data_gatherer.outputs.default_branch }}"
38-
$githubRef = "${{ github.ref }}"
39-
$isDefaultBranch = 'false'
40-
if ( $githubRef -like "*$defaultBranch*" ) {
41-
$isDefaultBranch = 'true'
42-
}
43-
Write-Output "::set-output name=is_default_branch::$(echo $isDefaultBranch)"
44-
4521
- name: Checkout repository
4622
id: checkout_repo
4723
uses: actions/checkout@v4
4824
with:
4925
token: ${{ secrets.GITHUB_TOKEN }}
5026
fetch-depth: 0
5127

52-
- if: steps.conditionals_handler.outputs.is_default_branch == 'true'
53-
name: Bump GH tag
54-
id: tag_generator
55-
uses: mathieudutour/[email protected]
56-
with:
57-
github_token: ${{ secrets.GITHUB_TOKEN }}
58-
default_bump: false
59-
release_branches: ${{ steps.data_gatherer.outputs.default_branch }}
60-
6128
- name: Build projects
6229
id: build_projects
6330
shell: pwsh

0 commit comments

Comments
 (0)