Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 21 additions & 33 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ extends:
#TODO maybe missing template context with sdl baselines?
steps:
- checkout: self
persistCredentials: true

- task: JavaToolInstaller@1
inputs:
Expand All @@ -68,26 +67,26 @@ extends:

- script: ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true -PmavenCentralSnapshotArtifactSuffix=""
displayName: Publish to local Maven for verification
# condition: contains(variables['build.sourceBranch'], 'refs/tags/v')
condition: contains(variables['build.sourceBranch'], 'refs/tags/v')

# - script: ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true
# displayName: Publish to local Maven for verification
# condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))
- script: ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true
displayName: Publish to local Maven for verification
condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))

- script: ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true -PmavenCentralSnapshotArtifactSuffix=""
displayName: Publish to local Maven ADO for ESRP
# condition: contains(variables['build.sourceBranch'], 'refs/tags/v')
condition: contains(variables['build.sourceBranch'], 'refs/tags/v')

# - script: ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true
# displayName: Publish to local Maven ADO for ESRP
# condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))
- script: ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true
displayName: Publish to local Maven ADO for ESRP
condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))

- pwsh: |
$contents = Get-Content gradle.properties -Raw
$major = $contents | Select-String -Pattern 'mavenMajorVersion = ([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
$minor = $contents | Select-String -Pattern 'mavenMinorVersion = ([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
$patch = $contents | Select-String -Pattern 'mavenPatchVersion = ([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
# $snapshot_suffix = if ($Env:BRANCH_NAME.StartsWith('refs/tags/v')) { '' } else { '-SNAPSHOT' }
$major = $contents | Select-String -Pattern 'mavenMajorVersion\s*=\s*([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
$minor = $contents | Select-String -Pattern 'mavenMinorVersion\s*=\s*([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
$patch = $contents | Select-String -Pattern 'mavenPatchVersion\s*=\s*([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
$snapshot_suffix = if ($Env:BRANCH_NAME.StartsWith('refs/tags/v')) { '' } else { '-SNAPSHOT' }
$version = "$major.$minor.$patch$snapshot_suffix"
echo "Current version is $version"
echo "##vso[task.setvariable variable=PACKAGE_VERSION;]$version"
Expand All @@ -101,21 +100,19 @@ extends:
displayName: Inspect contents of local Maven cache

- pwsh: |
.\scripts\zipPackageContent.ps1 -OutputDirectory $Env:OUTPUT_DIRECTORY -ArtifactId microsoft-graph-core -PackageSegment abstractions -Version $(PACKAGE_VERSION)
echo "list of zips:"
Get-ChildItem -Path $Env:OUTPUT_DIRECTORY -Filter "*.zip" | ForEach-Object { Write-Host $_.FullName }
displayName: Zip contents of local Maven cache
env:
OUTPUT_DIRECTORY: $(Build.ArtifactStagingDirectory)
$packageFullPath = Join-Path -Path "./" -ChildPath "build/publishing-repository/com/microsoft/graph/microsoft-graph-core" -AdditionalChildPath "$(PACKAGE_VERSION)"
echo "Package full path: $packageFullPath"
echo "##vso[task.setvariable variable=PACKAGE_PATH;]$packageFullPath"
displayName: Get the package full path

- task: 1ES.PublishPipelineArtifact@1
displayName: "Publish Artifact: jars"
inputs:
artifactName: jars
targetPath: "$(Build.ArtifactStagingDirectory)"
targetPath: "$(PACKAGE_PATH)"

- stage: deploy
# condition: and(or(contains(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], '${{ parameters.previewBranch }}')), succeeded())
condition: and(or(contains(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], '${{ parameters.previewBranch }}')), succeeded())
dependsOn: build
jobs:
- deployment: deploy_github
Expand All @@ -137,7 +134,7 @@ extends:
deploy:
steps:
- pwsh: |
$zips = Get-ChildItem -Path "$(Pipeline.Workspace)" -Filter "*.zip"
$zips = Get-ChildItem -Path "$(Pipeline.Workspace)" -Filter "*.jar"
$zip = $zips | Select-Object -First 1
$zipName = $zip.Name
if ($zipName -match "\d+.\d+.\d+")
Expand All @@ -148,19 +145,10 @@ extends:
}
else
{
Write-Error "No valid version found in zip file name."
Write-Error "No valid version found in jar file name."
exit 1
}

- pwsh: |
$zips = Get-ChildItem -Path "$(Pipeline.Workspace)" -Filter "*.zip"
foreach ($zip in $zips) {
$targetPath = $zip.FullName.Replace(".zip", "")
Expand-Archive -Path $zip.FullName -DestinationPath $targetPath
Remove-Item -Path $zip.FullName -Force
}
displayName: Unzip artifacts

- task: GitHubRelease@1
inputs:
gitHubConnection: "microsoftkiota"
Expand Down Expand Up @@ -204,7 +192,7 @@ extends:

- deployment: deploy_maven
# snapshots are not supported by ESRP release for now, but they are planning to add support. When it happens, simply remove the condition
# condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded())
condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded())
pool:
name: Azure-Pipelines-1ESPT-ExDShared
os: linux
Expand Down
160 changes: 0 additions & 160 deletions .github/workflows/build-and-publish.yml

This file was deleted.

15 changes: 0 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ plugins {
id 'jacoco'
id 'com.github.spotbugs' version '6.2.0'
id "org.sonarqube" version "6.2.0.5505"
// TODO remove this dependency once we remove the GH WF
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
}

java {
Expand Down Expand Up @@ -122,19 +120,6 @@ publishing {
}
}
}
// TODO remove this section once we remove the GH WF
nexusPublishing {
repositories {
sonatype {
if (project.rootProject.file('local.properties').exists()) {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
username = properties.getProperty('sonatypeUsername')
password = properties.getProperty('sonatypePassword')
}
}
}
}

group = project.property('mavenGroupId')
version = "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenCentralSnapshotArtifactSuffix}"
Expand Down
31 changes: 0 additions & 31 deletions scripts/zipPackageContent.ps1

This file was deleted.