diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 00000000000..9d1d1d9c7b1 --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,3 @@ +manifest: true +primaryBranch: main +handleGHRelease: true diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml deleted file mode 100644 index 78e09b99e66..00000000000 --- a/.github/workflows/create-release.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: "create release" - -on: - workflow_dispatch: - push: - branches: - - main - -defaults: - run: - shell: bash - -permissions: - contents: write - -jobs: - create-tag: - runs-on: ubuntu-latest - outputs: - SDK_VERSION: ${{ steps.tag-step.outputs.SDK_VERSION }} - steps: - - uses: actions/checkout@v4 - - - name: Get SDK version and set environment variable - run: | - SDK_VERSION=$(grep 'SDK_VERSION' src/GraphConstants.php | grep -oE '[0-9]+\.[0-9]+\.[0-9A-Za-z.\-]+') - echo "SDK_VERSION=$SDK_VERSION" >> $GITHUB_ENV - - - id: tag-step - name: Create and publish tag - run: | - echo "SDK_VERSION is:"$SDK_VERSION - git tag $SDK_VERSION && git push origin $SDK_VERSION - echo "SDK_VERSION=$SDK_VERSION" >> "$GITHUB_OUTPUT" - - create-release: - needs: create-tag - env: - SDK_VERSION: ${{ needs.create-tag.outputs.SDK_VERSION }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Create Release - uses: ncipollo/release-action@v1 - with: - generateReleaseNotes: true - prerelease: ${{ contains( env.SDK_VERSION, 'RC') }} - skipIfReleaseExists: true - tag: ${{ env.SDK_VERSION }} - name: "Release ${{ env.SDK_VERSION }}" diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000000..9718ead750f --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "2.10.0" +} diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000000..6361e43e86d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# Changelog + +All notable changes to this project will be documented in this file. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c40e33c597d..01b648e2407 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,37 @@ There are a few different recommended paths to get contributions into the releas ## File issues The best way to get started with a contribution is to start a dialog with us. Sometimes features will be under development or out of scope for this library and it's best to check before starting work on contribution, especially for large work items. +## 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. + ## Pull requests If you are making documentation changes, feel free to submit a pull request against the **main** branch. All other pull requests should be submitted against the **main** branch or a specific feature branch. The master branch is intended to represent the code released in the most-recent composer package. diff --git a/README.md b/README.md index d769a6a015e..d0a9bcd131f 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,12 @@ ## Install the SDK You can install the PHP SDK with Composer by editing your `composer.json` file: -``` +```jsonc { "require": { + // x-release-please-start-version "microsoft/microsoft-graph": "^2.10.0" + // x-release-please-end } } ``` diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000000..36278f9da1a --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,26 @@ +{ + "bootstrap-sha": "272035ede24db5978797f441cd0bc1b1c58af836", + "exclude-paths": [ + ".git", + ".idea", + ".github", + ".vscode", + "tests", + "scripts" + ], + "release-type": "simple", + "include-component-in-tag": false, + "include-v-in-tag": true, + "changelog-type": "github", + "packages": { + ".": { + "package-name": "microsoft/microsoft-graph", + "changelog-path": "CHANGELOG.md", + "extra-files": [ + "src/GraphConstants.php", + "README.md" + ] + } + }, + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +} diff --git a/scripts/BumpPreviewSdkVersion.php b/scripts/BumpPreviewSdkVersion.php deleted file mode 100644 index 013281baf72..00000000000 --- a/scripts/BumpPreviewSdkVersion.php +++ /dev/null @@ -1,15 +0,0 @@ - 1) { - # Increment release candidate - $rcVersion = ($rcMatches[1]) ? intval($rcMatches[1]) + 1 : 2; - $splitVersion[2] = "0-RC{$rcVersion}"; - } else { - # Increment minor version - $splitVersion[1] = strval(intval($splitVersion[1]) + 1); - # Set patch - $splitVersion[2] = '0'; - } - return implode(".", $splitVersion); -} - -function updateReadme(string $bumpedVersion) -{ - echo "Reading contents at ".README_FILEPATH."...\n"; - $fileContents = file_get_contents(README_FILEPATH); - if ($fileContents) { - $package = str_replace('/', '\/', PACKAGE_NAME); - $pattern = '/"'.$package.'"\s*:\s*".+"/'; - $replacement = '"'.PACKAGE_NAME.'": "^'.$bumpedVersion.'"'; - $numReplacements = 0; - $updatedContents = preg_replace($pattern, $replacement, $fileContents, -1, $numReplacements); - if (!$numReplacements) { - echo "Unable to find and replace SDK version\n"; - return; - } - echo file_put_contents(README_FILEPATH, $updatedContents) ? "Successfully updated ".README_FILEPATH. "\n" : "Failed to update ".README_FILEPATH."\n"; - return; - } - echo "Could not read contents at ".README_FILEPATH."\n"; -} - -function updateGraphConstants(string $filePath, string $bumpedVersion) -{ - echo "Reading contents at {$filePath}...\n"; - $fileContents = file_get_contents($filePath); - if ($fileContents) { - $pattern = '/'. SDK_VERSION_VAR_NAME . '\s+=\s+".+"/'; - $replacement = SDK_VERSION_VAR_NAME . " = \"{$bumpedVersion}\""; - $numReplacements = 0; - $updatedContents = preg_replace($pattern, $replacement, $fileContents, -1, $numReplacements); - if (!$numReplacements) { - echo "Unable to find and replace SDK version\n"; - return; - } - echo file_put_contents($filePath, $updatedContents) ? "Successfully updated {$filePath}\n" : "Failed to update {$filePath}\n"; - return; - } - echo "Could not read contents at {$filePath}\n"; -} diff --git a/src/GraphConstants.php b/src/GraphConstants.php index f53abedd6d2..a16881e88c3 100644 --- a/src/GraphConstants.php +++ b/src/GraphConstants.php @@ -19,5 +19,7 @@ final class GraphConstants { const API_VERSION = "v1.0"; + // x-release-please-start-version const SDK_VERSION = "2.10.0"; + // x-release-please-end }