Skip to content

Commit a3989fe

Browse files
authored
Merge pull request #526 from microsoftgraph/dev
1.3.0 Release
2 parents a16d04f + 9399213 commit a3989fe

File tree

244 files changed

+53264
-29952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+53264
-29952
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
steps:
5+
- checkout: self
6+
clean: true
7+
fetchDepth: 1
8+
persistCredentials: true
9+
10+
- task: PowerShell@2
11+
displayName: "Configure user"
12+
inputs:
13+
targetType: "inline"
14+
script: |
15+
git config --global user.email "[email protected]"
16+
git config --global user.name "Microsoft Graph DevX Tooling"
17+
18+
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
19+
displayName: "Run CredScan"
20+
inputs:
21+
debugMode: false
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
parameters:
5+
- name: Branch
6+
type: string
7+
default: "WeeklyOpenApiDocsDownload"
8+
- name: BaseBranch
9+
type: string
10+
default: "dev"
11+
12+
jobs:
13+
- job: GetLatestDocs
14+
displayName: Download OpenApiDocs
15+
pool: MsGraphDevXAzureAgents
16+
steps:
17+
- template: ./checkout.yml
18+
19+
- template: ./install-tools.yml
20+
21+
- task: PowerShell@2
22+
name: "ComputeBranch"
23+
displayName: "Compute weekly branch name"
24+
inputs:
25+
targetType: inline
26+
script: |
27+
$branch = "{0}/{1}" -f "$(Branch)", (Get-Date -Format yyyyMMddHHmm)
28+
Write-Host "##vso[task.setvariable variable=WeeklyBranch;isOutput=true]$branch"
29+
30+
- task: Bash@3
31+
displayName: "Create weekly branch"
32+
inputs:
33+
targetType: inline
34+
script: |
35+
git status
36+
git fetch --all
37+
git checkout $(BaseBranch)
38+
git branch $(ComputeBranch.WeeklyBranch)
39+
git checkout $(ComputeBranch.WeeklyBranch)
40+
git status
41+
42+
- task: PowerShell@2
43+
displayName: Download v1.0 OpenApi docs
44+
continueOnError: false
45+
inputs:
46+
filePath: "$(System.DefaultWorkingDirectory)/tools/UpdateOpenApi.ps1"
47+
pwsh: true
48+
49+
- task: PowerShell@2
50+
displayName: Download beta OpenApi docs
51+
continueOnError: false
52+
inputs:
53+
filePath: "$(System.DefaultWorkingDirectory)/tools/UpdateOpenApi.ps1"
54+
arguments: "-BetaGraphVersion"
55+
pwsh: true
56+
57+
- task: PowerShell@2
58+
name: OpenAPIDocDiff
59+
displayName: Get OpenAPI docs diff
60+
inputs:
61+
pwsh: true
62+
targetType: "inline"
63+
script: |
64+
$diff = git diff --name-only
65+
$ModulesWithChanges = @{}
66+
$diff | %{
67+
if (($_ -match 'openApiDocs\/(v1.0|beta)\/(.*).yml') -and !$ModulesWithChanges.ContainsKey($matches.2))
68+
{
69+
$ModulesWithChanges.Add($matches.2, $matches.1)
70+
}
71+
}
72+
$ModuleNames = $ModulesWithChanges.Keys
73+
Write-Host "##vso[task.setvariable variable=ModulesWithChanges;isOutput=true]$ModuleNames"
74+
75+
- task: PowerShell@2
76+
displayName: Generate profiles
77+
condition: and(succeeded(), ne(variables['OpenAPIDocDiff.ModulesWithChanges'], ''))
78+
continueOnError: false
79+
inputs:
80+
targetType: filePath
81+
pwsh: true
82+
filePath: $(System.DefaultWorkingDirectory)/tools/GenerateProfiles.ps1
83+
84+
- task: PowerShell@2
85+
name: CalculateAndBumpModuleVersion
86+
displayName: Calculate and bump module version
87+
condition: and(succeeded(), ne(variables['OpenAPIDocDiff.ModulesWithChanges'], ''))
88+
inputs:
89+
pwsh: true
90+
targetType: inline
91+
script: |
92+
# Calculate meta-module version
93+
$MetaModule = Find-Module "Microsoft.Graph" -Repository PSGallery
94+
$MetaModuleVersion = [System.Version]($MetaModule.Version)
95+
$NewMetaModuleVersion = "$($MetaModuleVersion.Major).$($MetaModuleVersion.Minor + 1).$($MetaModuleVersion.Build)"
96+
# Bump meta-module minor version
97+
Write-Host "Bumping Microsoft.Graph to $NewMetaModuleVersion."
98+
& "$(System.DefaultWorkingDirectory)\tools\SetMetaModuleVersion.ps1" -VersionNumber $NewMetaModuleVersion
99+
100+
# Calculate existing service module version
101+
"$(OpenAPIDocDiff.ModulesWithChanges)" -split " " | ForEach-Object {
102+
try {
103+
$Module = Find-Module "Microsoft.Graph.$_" -Repository PSGallery -ErrorAction Stop
104+
$ModuleVersion = [System.Version]($Module.Version)
105+
$NewModuleVersion = "$($ModuleVersion.Major).$($ModuleVersion.Minor + 1).$($ModuleVersion.Build)"
106+
Write-Host "Bumping $_ to $NewModuleVersion."
107+
. "$(System.DefaultWorkingDirectory)\tools\SetServiceModuleVersion.ps1" -VersionNumber $NewModuleVersion -Modules $_
108+
} catch {
109+
if ($_.Exception.Message -like "No match*") {
110+
Write-Warning "$_. Version will be set to $NewMetaModuleVersion."
111+
}
112+
}
113+
}
114+
115+
# Calculate new service module version
116+
$NewModuleReadMePath = Join-Path $(System.DefaultWorkingDirectory) "/tools/Templates/readme.md"
117+
. "$(System.DefaultWorkingDirectory)\tools\WriteToModuleReadMe.ps1" -ReadMePath $NewModuleReadMePath -FieldName "module-version" -NewFieldValue $NewMetaModuleVersion
118+
119+
- task: Bash@3
120+
displayName: Commit downloaded files
121+
condition: and(succeeded(), ne(variables['OpenAPIDocDiff.ModulesWithChanges'], ''))
122+
env:
123+
GITHUB_TOKEN: $(GITHUB_TOKEN)
124+
inputs:
125+
targetType: inline
126+
script: |
127+
git status
128+
git add .
129+
git commit -m 'Weekly OpenApiDocs Download'
130+
git status
131+
git push --set-upstream origin $(ComputeBranch.WeeklyBranch)
132+
git status
133+
134+
# References
135+
# [0] https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
136+
# [1] https://hub.github.com/hub-pull-request.1.html
137+
# https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
steps:
5+
- task: UseDotNet@2
6+
displayName: "Use .NET Core SDK 2.x"
7+
inputs:
8+
debugMode: false
9+
version: 2.x
10+
11+
- task: NuGetToolInstaller@1
12+
displayName: Install Nuget 5.7
13+
inputs:
14+
versionSpec: 5.7.0
15+
checkLatest: false # Optional
16+
17+
- task: NuGetAuthenticate@0
18+
displayName: Authenticate NuGet
19+
20+
- task: PowerShell@2
21+
displayName: Install Powershell core
22+
inputs:
23+
targetType: inline
24+
script: |
25+
dotnet tool update --global PowerShell
26+
pwsh
27+
28+
- task: PowerShell@2
29+
displayName: Version check
30+
inputs:
31+
targetType: inline
32+
pwsh: true
33+
script: |
34+
Write-Host $PSVersionTable.PSVersion
35+
Write-Host $host.Version
36+
Write-Host (Get-Host).Version
37+
38+
- task: NodeTool@0
39+
displayName: Install NodeJs 14.11.0
40+
inputs:
41+
versionSpec: "14.11.0"
42+
checkLatest: true # Optional
43+
44+
- task: Npm@1
45+
displayName: Install AutoRest
46+
inputs:
47+
command: "custom"
48+
customCommand: "install -g autorest@latest"
49+
50+
- task: PowerShell@2
51+
displayName: Install PowerShell dependencies
52+
inputs:
53+
targetType: inline
54+
pwsh: true
55+
errorActionPreference: "continue"
56+
script: |
57+
Install-Module "powershell-yaml" -Repository PSGallery -Force
58+
59+
- task: PowerShell@2
60+
displayName: Register PS repository
61+
enabled: false
62+
inputs:
63+
targetType: inline
64+
pwsh: true
65+
errorActionPreference: "continue"
66+
script: |
67+
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::Continue
68+
Get-PSRepository
69+
$patToken = '$(NUGETFEEDKEY)' | ConvertTo-SecureString -AsPlainText -Force
70+
$nugetFeed = '$(NUGETFEED)'
71+
$user = '$(NUGETBUILDUSER)'
72+
$credsAzureDevopsServices = New-Object System.Management.Automation.PSCredential($user, $patToken)
73+
UnRegister-PackageSource -Name 'LocalNugetPackageSource' -ErrorAction Continue
74+
UnRegister-PSRepository -Name 'LocalNugetFeed' -ErrorAction Continue
75+
Register-PackageSource -Name 'LocalNugetPackageSource' -Location $nugetFeed -SkipValidate -Trusted -Verbose -ProviderName 'Nuget' -ErrorAction Continue
76+
Register-PSRepository -Name 'LocalNugetFeed' -SourceLocation $nugetFeed -PublishLocation $nugetFeed -InstallationPolicy Trusted -Credential $credsAzureDevopsServices -PackageManagementProvider 'Nuget' -ErrorAction Continue
77+
Get-PSRepository
78+
Find-Module -Name Microsoft.Graph.Authentication -AllowPrerelease -Credential $credsAzureDevopsServices -AllVersions -Repository 'LocalNugetFeed'
79+
Find-Module -Name Microsoft.Graph.Authentication -AllowPrerelease -Repository 'LocalNugetFeed'

.azure-pipelines/download-openapidocs-template.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)