diff --git a/.azure-pipelines/buildAndPackage.yml b/.azure-pipelines/buildAndPackage.yml deleted file mode 100644 index 7b0f89d28..000000000 --- a/.azure-pipelines/buildAndPackage.yml +++ /dev/null @@ -1,111 +0,0 @@ -#Copyright (c) Microsoft Corporation. All rights reserved. -#Licensed under the MIT License. -#Building and packaging the artifacts of the Java-Core libraries using the build.gradle file. -#Ready the package for deployment and release. - -trigger: - branches: - include: - - dev - - main - - master - paths: - include: - - src/* - exclude: - - .gradle/wrapper - - .gitignore - - CONTRIBUTING.md - - LICENSE - - THIRD PARTY NOTICES - - gradle.properties - - gradlew - - gradlew.bat - - readme.md - - settings.gradle - - Scripts/* - -pr: -- dev -- master - -pool: - vmImage: windows-latest - -variables: - DROP_PATH: '$(Agent.BuildDirectory)/Drop' - -stages: -- stage: Build - jobs: - - job: Build - steps: - - template: templates/build/checkout-and-credscan.yml - - template: templates/install-java.yml - - template: templates/secure-files.yml - parameters: - stageID: 'build' - - template: templates/build/build-and-coverage.yml - - template: templates/build/publish-artefacts.yml - -- stage: Maven_Preview - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev')) - jobs: - - deployment: Maven_Preview - environment: 'MSGraph SDK Development - Java' - pool: - vmImage: windows-latest - strategy: - runOnce: - deploy: - steps: - - template: templates/download-artifacts.yml - parameters: - directoryPath: $(DROP_PATH) - - template: templates/install-java.yml - - template: templates/secure-files.yml - - template: templates/copy-and-build.yml - parameters: - task: 'publishSnapshotPublicationToSonatypeSnapshotRepository' - directoryPath: $(DROP_PATH) - -- stage: Maven_Release_And_Github_Release - dependsOn: Build - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) - jobs: - - deployment: Maven_Release - environment: 'MSGraph SDK Development - Java' - pool: - vmImage: windows-latest - strategy: - runOnce: - deploy: - steps: - - template: templates/download-artifacts.yml - parameters: - directoryPath: $(DROP_PATH) - - template: templates/install-java.yml - - template: templates/secure-files.yml - parameters: - stageID: 'release' - - template: templates/copy-and-build.yml - parameters: - task: 'publishMavenCentralReleasePublicationToSonatypeRepository' - directoryPath: $(DROP_PATH) - - - deployment: Github_Release - dependsOn: Maven_Release - environment: 'MSGraph SDK Development - Java' - pool: - vmImage: windows-latest - strategy: - runOnce: - deploy: - steps: - - template: templates/download-artifacts.yml - parameters: - directoryPath: $(DROP_PATH) - - template: templates/version-and-release.yml - parameters: - gitConnection: 'microsoftgraphrelease' - directoryPath: $(DROP_PATH) diff --git a/.azure-pipelines/templates/build/build-and-coverage.yml b/.azure-pipelines/templates/build/build-and-coverage.yml deleted file mode 100644 index 02ce894a2..000000000 --- a/.azure-pipelines/templates/build/build-and-coverage.yml +++ /dev/null @@ -1,16 +0,0 @@ -steps: -- task: Gradle@2 - inputs: - gradleWrapperFile: '$(Build.SourcesDirectory)/gradlew' - tasks: 'build' - publishJUnitResults: true - testResultsFiles: '**/TEST-*.xml' - javaHomeOption: 'JDKVersion' - sonarQubeRunAnalysis: false - -- task: PublishCodeCoverageResults@1 - inputs: - codeCoverageTool: 'JaCoCo' - summaryFileLocation: $(System.DefaultWorkingDirectory)/build/reports/jacoco/test/jacocoTestReport.xml - pathToSources: $(System.DefaultWorkingDirectory)/src/main/java - failIfCoverageEmpty: true \ No newline at end of file diff --git a/.azure-pipelines/templates/build/checkout-and-credscan.yml b/.azure-pipelines/templates/build/checkout-and-credscan.yml deleted file mode 100644 index a6b9c4b9d..000000000 --- a/.azure-pipelines/templates/build/checkout-and-credscan.yml +++ /dev/null @@ -1,9 +0,0 @@ -steps: -- checkout: self - clean: true - fetchDepth: 1 - -- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3 - displayName: 'Run CredScan' - inputs: - debugMode: false diff --git a/.azure-pipelines/templates/build/publish-artefacts.yml b/.azure-pipelines/templates/build/publish-artefacts.yml deleted file mode 100644 index 5c67587a8..000000000 --- a/.azure-pipelines/templates/build/publish-artefacts.yml +++ /dev/null @@ -1,22 +0,0 @@ -steps: -- task: CopyFiles@2 - condition: ne(variables['Build.Reason'], 'PullRequest') - inputs: - SourceFolder: '$(System.DefaultWorkingDirectory)' - Contents: | - **/libs/* - build/generated-pom.xml - build/generated-pom.xml.asc - build.gradle - gradlew - gradlew.bat - settings.gradle - gradle.properties - **/gradle/** - Scripts/** - TargetFolder: '$(Build.ArtifactStagingDirectory)/' - -- publish: $(Build.ArtifactStagingDirectory) - condition: ne(variables['Build.Reason'], 'PullRequest') - artifact: Drop - displayName: Publish Build Artifact diff --git a/.azure-pipelines/templates/copy-and-build.yml b/.azure-pipelines/templates/copy-and-build.yml deleted file mode 100644 index 787fe1a6f..000000000 --- a/.azure-pipelines/templates/copy-and-build.yml +++ /dev/null @@ -1,25 +0,0 @@ -parameters: -- name: task - type: string - default: '' -- name: directoryPath - type: string - -steps: -- task: CopyFiles@2 - inputs: - SourceFolder: '$(Agent.TempDirectory)' - Contents: '**' - TargetFolder: '${{ parameters.directoryPath }}/' - -- task: Gradle@2 - inputs: - gradleWrapperFile: ${{ parameters.directoryPath }}/gradlew - workingDirectory: '${{ parameters.directoryPath }}/' - options: '-x jar -x javadoc -x javadocJar -x compileJava -x processResources -x classes -x sourceJar' - tasks: ${{ parameters.task }} - publishJUnitResults: true - testResultsFiles: '**/TEST-*.xml' - javaHomeOption: 'JDKVersion' - sonarQubeRunAnalysis: false - spotBugsAnalysis: false diff --git a/.azure-pipelines/templates/download-artifacts.yml b/.azure-pipelines/templates/download-artifacts.yml deleted file mode 100644 index ecd6d7d9e..000000000 --- a/.azure-pipelines/templates/download-artifacts.yml +++ /dev/null @@ -1,14 +0,0 @@ -parameters: -- name: directoryPath - type: string - -steps: - - download: none - - task: DownloadPipelineArtifact@2 - inputs: - source: current - artifact: Drop - path: '${{ parameters.directoryPath }}/' - patterns: | - ** - * diff --git a/.azure-pipelines/templates/install-java.yml b/.azure-pipelines/templates/install-java.yml deleted file mode 100644 index 82e866466..000000000 --- a/.azure-pipelines/templates/install-java.yml +++ /dev/null @@ -1,11 +0,0 @@ -steps: -- pwsh: 'Invoke-WebRequest -Uri https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16%2B36/OpenJDK16-jdk_x64_windows_hotspot_16_36.zip -OutFile OpenJDK.zip' - displayName: 'Download JDK' - -- task: JavaToolInstaller@0 - inputs: - versionSpec: '16' - jdkArchitectureOption: 'x64' - jdkSourceOption: 'LocalDirectory' - jdkFile: 'OpenJDK.zip' - jdkDestinationDirectory: 'binaries' \ No newline at end of file diff --git a/.azure-pipelines/templates/secure-files.yml b/.azure-pipelines/templates/secure-files.yml deleted file mode 100644 index 01086fc53..000000000 --- a/.azure-pipelines/templates/secure-files.yml +++ /dev/null @@ -1,29 +0,0 @@ -parameters: -- name: stageID - type: string - default: '' - -steps: -- task: DownloadSecureFile@1 - inputs: - secureFile: 'local.properties' - retryCount: '5' - -- ${{ if or(eq(parameters.stageID, 'build'), eq(parameters.stageID, 'release')) }}: - - task: DownloadSecureFile@1 - inputs: - secureFile: 'secring.gpg' - retryCount: '5' - - - task: DownloadSecureFile@1 - inputs: - secureFile: 'secring.gpg.lock' - retryCount: '5' - -- ${{ if eq(parameters.stageID, 'build') }}: - - task: CopyFiles@2 - inputs: - SourceFolder: '$(Agent.TempDirectory)' - Contents: '**' - TargetFolder: '$(System.DefaultWorkingDirectory)' - diff --git a/.azure-pipelines/templates/version-and-release.yml b/.azure-pipelines/templates/version-and-release.yml deleted file mode 100644 index 92eb32359..000000000 --- a/.azure-pipelines/templates/version-and-release.yml +++ /dev/null @@ -1,27 +0,0 @@ -parameters: -- name: gitConnection - type: string - default: '' -- name: directoryPath - type: string - -steps: -- task: PowerShell@2 - inputs: - filePath: '${{ parameters.directoryPath }}/Scripts/getLatestVersion.ps1' - arguments: '-propertiesPath "${{ parameters.directoryPath }}/gradle.properties"' - pwsh: true - -- task: GitHubRelease@1 - inputs: - gitHubConnection: ${{ parameters.gitConnection }} - repositoryName: '$(Build.Repository.Name)' - action: 'create' - target: '$(Build.SourceVersion)' - tagSource: 'userSpecifiedTag' - tag: '$(VERSION_STRING)' - assets: | - !**/** - $(Build.ArtifactStagingDirectory)/* - changeLogCompareToRelease: 'lastFullRelease' - changeLogType: 'commitBased' diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 000000000..fc73eb9be --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,113 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Build and Publish + +on: + push: + branches: [ dev , master ] + paths: + - 'src/**' + - '.github/**' + - '!.gradle/wrapper' + - '!.gitignore' + - '!LICENSE' + - '!THIRD PARTY NOTICES' + - '!*.md' + - '*.gradle' +env: + PREVIEW_TASK: publishSnapshotPublicationToSonatypeSnapshotRepository + PUBLISH_TASK: publishMavenCentralReleasePublicationToSonatypeRepository + +jobs: + maven_Preview: + if: ${{ github.ref == 'refs/head/dev' }} + environment: + name: maven_central_snapshot + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Easy detect-secrets + uses: RobertFischer/detect-secrets-action@v2.0.0 + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: '16' + distribution: 'adopt' + cache: gradle + - run: .\scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH + shell: pwsh + env: + ENCODED_VALUE: ${{ secrets.LOCAL_PROPERTIES }} + OUTPUT_PATH: .\local.properties + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Publish + run: ./gradlew $PREVIEW_TASK + + maven_Release: + if: ${{ github.ref == 'ref/head/master' }} + environment: + name: maven_central_release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Easy detect-secrets + uses: RobertFischer/detect-secrets-action@v2.0.0 + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: '16' + distribution: 'adopt' + cache: gradle + - run: .\scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH + shell: pwsh + env: + ENCODED_VALUE: ${{ secrets.LOCAL_PROPERTIES }} + OUTPUT_PATH: .\local.properties + - run: .\scripts\decodeAndWrite.ps1 -encodedValue $env:ENCODED_VALUE -outputPath $env:OUTPUT_PATH + shell: pwsh + env: + ENCODED_VALUE: ${{ secrets.SECRING_GPG }} + OUTPUT_PATH: .\secring.gpg + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Publish + run: ./gradlew $PUBLISH_TASK + - name: Upload Build Artifact + uses: actions/upload-artifact@v2.2.4 + with: + name: drop + path: | + **/libs/* + build/generated-pom.xml + build/generated-pom.xml.asc + build.gradle + gradlew + gradlew.bat + settings.gradle + gradle.properties + **/gradle/** + Scripts/** + + githubRelease: + needs: maven_Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Download Build Artifact + uses: actions/download-artifact@v2.0.10 + with: + name: drop + path: drop + - name: Github Release + uses: anton-yurchenko/git-release@v4.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} + DRAFT_RELEASE: "false" + PRE_RELEASE: "false" + CHANGELOG_FILE: "CHANGELOG.md" + ALLOW_EMPTY_CHANGELOG: "true" + with: + args: | + drop/** diff --git a/CHANGELOG.MD b/CHANGELOG.MD new file mode 100644 index 000000000..c391cb12f --- /dev/null +++ b/CHANGELOG.MD @@ -0,0 +1,11 @@ +#Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +##[Unreleased] +###Added +###Changed +##[x.x.x] - 2021-09-14 \ No newline at end of file