From 79c65196cab7a5e297a150902833422bbfb97445 Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Wed, 17 Apr 2024 23:51:50 +0300 Subject: [PATCH 1/8] ci: add release please bot --- .github/workflows/release-please.yml | 21 +++++++++++++++++++ .release-please-manifest.json | 3 +++ CHANGELOG.md | 9 -------- CONTRIBUTING.md | 31 ++++++++++++++++++++++++++++ gradle.properties | 6 ++++++ release-please-config.json | 29 ++++++++++++++++++++++++++ 6 files changed, 90 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/release-please.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000000..eb9f6d6006c --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,21 @@ +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + +name: release-please + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v4 + with: + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} # TODO: Create this token with repo + config-file: release-please-config.json # Set to update gradle.properties & pom.xml + manifest-file: .release-please-manifest.json + target-branch: main diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000000..e3d38e8f1f7 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "6.6.0" +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a39488cf8b..d98af2b77dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,15 +2,6 @@ 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 - ## [6.6.0] - 2024-04-16 ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b7a45fba211..8827dbcb773 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,6 +25,37 @@ Revisions of this nature will result in a 0.X.X change of the version number. All the code of the current repository is being generated automatically by the [SDK generator](https://github.com/microsoftgraph/MSGraph-SDK-Code-Generator/) in which any change must be reflected. +## Commit message format + +To support our automated release process, pull requests are required to follow the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) +format. + +Each commit message consists of a **header**, an optional **body** and an optional **footer**. The header is the first line of the commit and +MUST have a **type** (see below for a list of types) and a **description**. An optional **scope** can be added to the header to give extra context. + +``` +[optional scope]: + + + + +``` + +The recommended commit types used are: + + - **feat** for feature updates (increments the _minor_ version) + - **fix** for bug fixes (increments the _patch_ version) + - **perf** for performance related changes e.g. optimizing an algorithm + - **refactor** for code refactoring changes + - **test** for test suite updates e.g. adding a test or fixing a test + - **style** for changes that don't affect the meaning of code. e.g. formatting changes + - **docs** for documentation updates e.g. ReadMe update or code documentation updates + - **build** for build system changes (gradle updates, external dependency updates) + - **ci** for CI configuration file changes e.g. updating a pipeline + - **chore** for miscallaneous non-sdk changesin the repo e.g. removing an unused file + +Adding a footer with the prefix **BREAKING CHANGE:** will cause an increment of the _major_ version. + ## Add yourself as a contributor This project follows the [all contributors](https://github.com/kentcdodds/all-contributors) specification. When making a contribution, please add yourself to the table of contributors: diff --git a/gradle.properties b/gradle.properties index f623aef1a3d..3cb5da81c90 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,9 +25,15 @@ org.gradle.caching=true mavenGroupId = com.microsoft.graph mavenArtifactId = microsoft-graph +# x-release-please-start-major mavenMajorVersion = 6 +# x-release-please-end +# x-release-please-start-minor mavenMinorVersion = 6 +# x-release-please-end +# x-release-please-start-patch mavenPatchVersion = 0 +# x-release-please-end mavenArtifactSuffix = #These values are used to run functional tests diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000000..da68c63e2f3 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,29 @@ +{ + "bootstrap-sha": "TODO: Update this value", + "exclude-paths": [ + ".git", + ".idea", + ".github", + ".vscode" + ], + "release-type": "java", + "include-component-in-tag": false, + "include-v-in-tag": true, + "packages": { + ".": { + "package-name": "com.microsoft.graph.microsoft-graph", + "changelog-path": "CHANGELOG.md", + "extra-files": [ + { + "type": "generic", + "path": "gradle.properties" + }, + { + "type": "pom", + "path": "pom.xml" + } + ] + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +} From 11b7c3eac043c10bf4219fafcd29ce1a7428d662 Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Thu, 18 Apr 2024 00:05:50 +0300 Subject: [PATCH 2/8] ci: fix branch name for the release bot github action --- .github/workflows/release-please.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index eb9f6d6006c..b9728b5c0ab 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -1,7 +1,7 @@ on: push: branches: - - main + - dev permissions: contents: write @@ -18,4 +18,4 @@ jobs: token: ${{ secrets.RELEASE_PLEASE_TOKEN }} # TODO: Create this token with repo config-file: release-please-config.json # Set to update gradle.properties & pom.xml manifest-file: .release-please-manifest.json - target-branch: main + target-branch: dev From eee06798099975f5ce77dfbcd4521b12973471cb Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Thu, 18 Apr 2024 01:18:14 +0300 Subject: [PATCH 3/8] ci: set release bot scanning start SHA --- release-please-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-please-config.json b/release-please-config.json index da68c63e2f3..4086660a2f0 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -1,5 +1,5 @@ { - "bootstrap-sha": "TODO: Update this value", + "bootstrap-sha": "6342ecd17b3c26f5d27b33ff49a2ceedc206f140", "exclude-paths": [ ".git", ".idea", From aad22fe88cb46cf0335a20f4509b39db4590f528 Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Thu, 18 Apr 2024 01:59:04 +0300 Subject: [PATCH 4/8] ci: update release github action --- .github/workflows/git-release.yml | 28 +++++++++++++++++++--------- .github/workflows/release-please.yml | 6 +++--- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/git-release.yml b/.github/workflows/git-release.yml index 60f5ad8fc86..32ecd3f462b 100644 --- a/.github/workflows/git-release.yml +++ b/.github/workflows/git-release.yml @@ -22,14 +22,24 @@ jobs: event: push name: drop path: drop - - name: Github Release - uses: anton-yurchenko/git-release@v6.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DRAFT_RELEASE: "false" - PRE_RELEASE: "false" - CHANGELOG_FILE: "CHANGELOG.md" - ALLOW_EMPTY_CHANGELOG: "true" + ## TODO: Confirm that the old action can update an existing release. + # - name: Github Release + # uses: anton-yurchenko/git-release@v6.0 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # DRAFT_RELEASE: "false" + # PRE_RELEASE: "false" + # CHANGELOG_FILE: "CHANGELOG.md" + # ALLOW_EMPTY_CHANGELOG: "true" + # with: + # args: | + # drop/build/**/*.jar + # This action works with an existing release (created by the release bot) and uploads the build artifacts + - name: GitHub Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') with: - args: | + token: ${{ secrets.GITHUB_TOKEN }} + fail_on_unmatched_files: true + files: | drop/build/**/*.jar diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index b9728b5c0ab..eabcf949edc 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -7,7 +7,7 @@ permissions: contents: write pull-requests: write -name: release-please +name: release-bot jobs: release-please: @@ -15,7 +15,7 @@ jobs: steps: - uses: google-github-actions/release-please-action@v4 with: - token: ${{ secrets.RELEASE_PLEASE_TOKEN }} # TODO: Create this token with repo - config-file: release-please-config.json # Set to update gradle.properties & pom.xml + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} + config-file: release-please-config.json # Set to update gradle.properties, pom.xml & CHANGELOG.md manifest-file: .release-please-manifest.json target-branch: dev From 0feafc972b9d95f3f9d5c350904da66c48289fd2 Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Thu, 18 Apr 2024 02:12:20 +0300 Subject: [PATCH 5/8] ci: remove conflicting create_Tag job --- .github/workflows/preview-and-release.yml | 47 +++++++++-------- Scripts/incrementMinorVersion.ps1 | 64 ----------------------- 2 files changed, 24 insertions(+), 87 deletions(-) delete mode 100644 Scripts/incrementMinorVersion.ps1 diff --git a/.github/workflows/preview-and-release.yml b/.github/workflows/preview-and-release.yml index 32162dae2ba..72b7b4b3d40 100644 --- a/.github/workflows/preview-and-release.yml +++ b/.github/workflows/preview-and-release.yml @@ -95,26 +95,27 @@ jobs: **/gradle/** Scripts/** - create_Tag: - needs: maven_Release - runs-on: ubuntu-latest - permissions: - contents: write - env: - RELEASE_TAG: "" - steps: - - uses: actions/checkout@v4 - - name: Get Version - id: GetVersion - run: .\Scripts\getLatestVersion.ps1 - shell: pwsh - - name: Create tag - uses: rickstaa/action-create-tag@v1.7.2 - with: - tag: ${{ steps.GetVersion.outputs.tag }} - - name: Queue Git Release - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: Git Release - token: ${{ secrets.PERSONAL_TOKEN }} - ref: ${{ steps.GetVersion.outputs.tag }} + # release-please creates tags + # create_Tag: + # needs: maven_Release + # runs-on: ubuntu-latest + # permissions: + # contents: write + # env: + # RELEASE_TAG: "" + # steps: + # - uses: actions/checkout@v4 + # - name: Get Version + # id: GetVersion + # run: .\Scripts\getLatestVersion.ps1 + # shell: pwsh + # - name: Create tag + # uses: rickstaa/action-create-tag@v1.7.2 + # with: + # tag: ${{ steps.GetVersion.outputs.tag }} + # - name: Queue Git Release + # uses: benc-uk/workflow-dispatch@v1 + # with: + # workflow: Git Release + # token: ${{ secrets.PERSONAL_TOKEN }} + # ref: ${{ steps.GetVersion.outputs.tag }} diff --git a/Scripts/incrementMinorVersion.ps1 b/Scripts/incrementMinorVersion.ps1 deleted file mode 100644 index e7dbaf4cc1a..00000000000 --- a/Scripts/incrementMinorVersion.ps1 +++ /dev/null @@ -1,64 +0,0 @@ -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. - -<# -.Synopsis - Increment the minor version string in the gradle.properties if the major, - minor, or patch version hasn't been manually updated. -.Description - Assumptions: - Targets Gradle.properties - This script assumes it is run from the repo root. - Minor version is typically auto-incremented. - -#> - -function Update-ReadmeVersion([string]$readmeFilePath, [version]$version) { - $readmeFileContent = Get-Content -Path $readmeFilePath -Raw - $readmeFileContent = $readmeFileContent -replace "graph(\-beta)?:\d{1,}\.\d{1,}\.\d{1,}", "graph`$1:$($version.ToString())" - $gradleLineNumber = Select-String -Path $readmeFilePath -Pattern "```xml" | Select-Object -First 1 -ExpandProperty LineNumber; - $gradleLineNumber+= 4 # skipping triple tick, block open, comment, groupid, artifactid - $readmeLines = $readmeFileContent -split "`n" - $readmeLines[$gradleLineNumber] = $readmeLines[$gradleLineNumber] -replace "\d{1,}\.\d{1,}\.\d{1,}", $version.ToString() - $readmeFileContent = $readmeLines -join "`n" - Set-Content -Path $readmeFilePath $readmeFileContent -NoNewline -} - -function Update-TelemetryVersion([string]$telemetryFilePath, [version]$version) { - $telemetryFileContent = Get-Content -Path $telemetryFilePath -Raw - $telemetryFileContent = $telemetryFileContent -replace "\d{1,}\.\d{1,}\.\d{1,}", $version.ToString() - Set-Content -Path $telemetryFilePath $telemetryFileContent -NoNewline -} - -function Update-PackageVersion([string]$propertiesFilePath, [version]$version) { - $propertiesFileContent = Get-Content -Path $propertiesFilePath -Raw - $propertiesFileContent = $propertiesFileContent -replace "mavenMajorVersion\s+=\s+\d{1,}", "mavenMajorVersion = $($version.Major)" - $propertiesFileContent = $propertiesFileContent -replace "mavenMinorVersion\s+=\s+\d{1,}", "mavenMinorVersion = $($version.Minor)" - $propertiesFileContent = $propertiesFileContent -replace "mavenPatchVersion\s+=\s+\d{1,}", "mavenPatchVersion = $($version.Build)" - Set-Content -Path $propertiesFilePath $propertiesFileContent -NoNewline -} -function Get-CurrentTelemetryVersion([string]$telemetryFilePath) { - $telemetryFileContent = Get-Content -Path $telemetryFilePath -Raw - if($telemetryFileContent -match "(\d{1,}\.\d{1,}\.\d{1,})") { - return [version]::Parse($Matches[1]) - } else { - Write-Error "Invalid version number format" - return $null; - } -} - -function Update-MinorVersionNumber([version]$currentVersion) { - return [version]::new($currentVersion.Major, $currentVersion.Minor + 1, 0); -} - -function Update-MinorVersion() { - $readmeFilePath = Join-Path -Path $PWD.ToString() -ChildPath "../README.md" - $propertiesFilePath = Join-Path -Path $PWD.ToString() -ChildPath "../gradle.properties" - $telemetryFilePath = Join-Path -Path $PWD.ToString() -ChildPath "../src/main/java/com/microsoft/graph/info/Constants.java" - $currentVersion = Get-CurrentTelemetryVersion -telemetryFilePath $telemetryFilePath - $nextVersion = Update-MinorVersionNumber -currentVersion $currentVersion - Update-ReadmeVersion -version $nextVersion -readmeFilePath $readmeFilePath - Update-TelemetryVersion -version $nextVersion -telemetryFilePath $telemetryFilePath - Update-PackageVersion -version $nextVersion -propertiesFilePath $propertiesFilePath -} -Update-MinorVersion \ No newline at end of file From 281b3cd5514b83c7e278ea9d29103a823c747a51 Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Thu, 18 Apr 2024 05:27:06 +0300 Subject: [PATCH 6/8] ci: use simpler xml updater --- release-please-config.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/release-please-config.json b/release-please-config.json index 4086660a2f0..883bfd5403d 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -19,8 +19,9 @@ "path": "gradle.properties" }, { - "type": "pom", - "path": "pom.xml" + "type": "xml", + "path": "pom.xml", + "xpath": "//project/version" } ] } From e3683f39357729baefbe83417bbce7d22fac4e22 Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:07:51 +0300 Subject: [PATCH 7/8] ci: update version numbers in README & java Constants --- README.md | 4 ++++ release-please-config.json | 8 ++++++++ src/main/java/com/microsoft/graph/info/Constants.java | 2 ++ 3 files changed, 14 insertions(+) diff --git a/README.md b/README.md index 9a6e299c35c..1116305e892 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,9 @@ repositories { dependencies { // Include the sdk as a dependency + // x-release-please-start-version implementation 'com.microsoft.graph:microsoft-graph:6.6.0' + // x-release-please-end // This dependency is only needed if you are using a TokenCredential object for authentication implementation 'com.azure:azure-identity:1.11.0' } @@ -35,7 +37,9 @@ Add the dependency in `dependencies` in pom.xml com.microsoft.graph microsoft-graph + 6.6.0 + diff --git a/release-please-config.json b/release-please-config.json index 883bfd5403d..5b1f7c5fb62 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -18,6 +18,14 @@ "type": "generic", "path": "gradle.properties" }, + { + "type": "generic", + "path": "README.md" + }, + { + "type": "generic", + "path": "src/main/java/com/microsoft/graph/info/Constants.java" + }, { "type": "xml", "path": "pom.xml", diff --git a/src/main/java/com/microsoft/graph/info/Constants.java b/src/main/java/com/microsoft/graph/info/Constants.java index f67c288036e..62059f7adad 100644 --- a/src/main/java/com/microsoft/graph/info/Constants.java +++ b/src/main/java/com/microsoft/graph/info/Constants.java @@ -3,6 +3,8 @@ /** Multi-purpose constants holder used accross the SDK */ public final class Constants { /** The SDK version */ + // x-release-please-start-version public static final String VERSION_NAME = "6.6.0"; + // x-release-please-end } From cef573d78ac530dfe10cb88a3464ce7586084ec0 Mon Sep 17 00:00:00 2001 From: Caleb Kiage <747955+calebkiage@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:10:15 +0300 Subject: [PATCH 8/8] ci: cleanup commented out code --- .github/workflows/git-release.yml | 12 ----------- .github/workflows/preview-and-release.yml | 25 ----------------------- 2 files changed, 37 deletions(-) diff --git a/.github/workflows/git-release.yml b/.github/workflows/git-release.yml index 32ecd3f462b..ec3b0ecb87f 100644 --- a/.github/workflows/git-release.yml +++ b/.github/workflows/git-release.yml @@ -22,18 +22,6 @@ jobs: event: push name: drop path: drop - ## TODO: Confirm that the old action can update an existing release. - # - name: Github Release - # uses: anton-yurchenko/git-release@v6.0 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # DRAFT_RELEASE: "false" - # PRE_RELEASE: "false" - # CHANGELOG_FILE: "CHANGELOG.md" - # ALLOW_EMPTY_CHANGELOG: "true" - # with: - # args: | - # drop/build/**/*.jar # This action works with an existing release (created by the release bot) and uploads the build artifacts - name: GitHub Release uses: softprops/action-gh-release@v2 diff --git a/.github/workflows/preview-and-release.yml b/.github/workflows/preview-and-release.yml index 72b7b4b3d40..61f1afdff2b 100644 --- a/.github/workflows/preview-and-release.yml +++ b/.github/workflows/preview-and-release.yml @@ -94,28 +94,3 @@ jobs: gradle.properties **/gradle/** Scripts/** - - # release-please creates tags - # create_Tag: - # needs: maven_Release - # runs-on: ubuntu-latest - # permissions: - # contents: write - # env: - # RELEASE_TAG: "" - # steps: - # - uses: actions/checkout@v4 - # - name: Get Version - # id: GetVersion - # run: .\Scripts\getLatestVersion.ps1 - # shell: pwsh - # - name: Create tag - # uses: rickstaa/action-create-tag@v1.7.2 - # with: - # tag: ${{ steps.GetVersion.outputs.tag }} - # - name: Queue Git Release - # uses: benc-uk/workflow-dispatch@v1 - # with: - # workflow: Git Release - # token: ${{ secrets.PERSONAL_TOKEN }} - # ref: ${{ steps.GetVersion.outputs.tag }}