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
56 changes: 22 additions & 34 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,54 +67,52 @@ 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"
displayName: Get current version
name: GetVersion
env:
BRANCH_NAME: $(Build.SourceBranchName)
BRANCH_NAME: $(Build.SourceBranch)

- pwsh: |
.\scripts\validatePackageContents.ps1 -ArtifactId microsoft-graph -Version $(PACKAGE_VERSION) -ValidateMavenMetadata $false
displayName: Inspect contents of local Maven cache

- pwsh: |
.\scripts\zipPackageContent.ps1 -OutputDirectory $Env:OUTPUT_DIRECTORY -ArtifactId microsoft-graph -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" -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,18 +145,9 @@ 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:
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
170 changes: 0 additions & 170 deletions .github/workflows/preview-and-release.yml

This file was deleted.

16 changes: 0 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ plugins {
id 'eclipse'
id 'maven-publish'
id 'signing'
// 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 @@ -89,20 +87,6 @@ publishing {
}
}

// TODO remove this configuration 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.

Loading