diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index d34200a2..c2f9a9aa 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -13,7 +13,7 @@ on: - synchronize permissions: - pull-requests: read + pull-requests: write jobs: main: @@ -21,5 +21,30 @@ jobs: runs-on: ubuntu-latest steps: - uses: amannn/action-semantic-pull-request@v5 + id: lint_pr_title env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: marocchino/sticky-pull-request-comment@v2 + # When the previous steps fails, the workflow would stop. By adding this + # condition you can continue the execution with the populated error message. + if: always() && (steps.lint_pr_title.outputs.error_message != null) + with: + header: pr-title-lint-error + message: | + Hey there and thank you for opening this pull request! ๐Ÿ‘‹๐Ÿผ + + We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. + + Details: + + ``` + ${{ steps.lint_pr_title.outputs.error_message }} + ``` + + # Delete a previous comment when the issue has been resolved + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: pr-title-lint-error + delete: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..0ce210fc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,66 @@ +name: Run Release Please + +on: + workflow_dispatch: + inputs: + + push: + branches: + - main + +jobs: + release-please: + runs-on: ubuntu-latest + + # Release-please creates a PR that tracks all changes + steps: + - uses: google-github-actions/release-please-action@v3 + id: release + with: + command: manifest + token: ${{secrets.GITHUB_TOKEN}} + default-branch: main + signoff: "OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>" + - name: Dump Release Please Output + env: + RELEASE_PLEASE_OUTPUT: ${{ toJson(steps.release.outputs) }} + run: | + echo "$RELEASE_PLEASE_OUTPUT" + outputs: + release_created: ${{ steps.release.outputs.releases_created }} + all: ${{ toJSON(steps.release.outputs) }} + paths_released: ${{ steps.release.outputs.paths_released }} + + pypi-release: + needs: release-please + runs-on: ubuntu-latest + if: ${{ needs.release-please.outputs.release_created }} + strategy: + matrix: + path: ${{ fromJSON(needs.release-please.outputs.paths_released) }} + environment: release + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing to pypi + id-token: write + container: + image: "python:3.12" + + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Upgrade pip + run: pip install --upgrade pip + + - name: Install hatch + run: pip install hatch + + - name: Build a binary wheel and a source tarball + run: hatch build + working-directory: ${{ matrix.path }} + + - name: Publish a Python distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: ${{ matrix.path }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..b98dfd69 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,4 @@ +{ + "hooks/openfeature-hooks-opentelemetry": "0.1.0", + "providers/openfeature-provider-flagd": "0.1.0" +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 07031016..3f9c9096 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,13 +28,6 @@ We use `pytest` for our unit testing, making use of `parametrized` to inject cas These are planned once the SDK has been stabilized and a Flagd provider implemented. At that point, we will utilize the [gherkin integration tests](https://github.com/open-feature/test-harness/blob/main/features/evaluation.feature) to validate against a live, seeded Flagd instance. -### Packaging - -We publish to the PyPI repository, where you can find each individual package: - -- [openfeature-provider-flagd](https://pypi.org/project/openfeature-provider-flagd/) -- [openfeature-hooks-opentelemetry](https://pypi.org/project/openfeature-hooks-opentelemetry/) - ## Pull Request All contributions to the OpenFeature project are welcome via GitHub pull requests. @@ -48,7 +41,7 @@ git clone https://github.com/open-feature/python-sdk-contrib.git openfeature-pyt Navigate to the repository folder ```bash -cd openfeature-python-sdk-contrib +cd python-sdk-contrib ``` Add your fork as an origin diff --git a/hooks/README.md b/hooks/README.md index 70f53f6f..c9de753f 100644 --- a/hooks/README.md +++ b/hooks/README.md @@ -1,4 +1,5 @@ # OpenFeature Python Hooks + Hooks are a mechanism whereby application developers can add arbitrary behavior to flag evaluation. -They operate similarly to middleware in many web frameworks. Please see the -[spec](https://openfeature.dev/specification/sections/hooks) for more details. +They operate similarly to middleware in many web frameworks. +Please see the [spec](https://openfeature.dev/specification/sections/hooks) for more details. diff --git a/providers/README.md b/providers/README.md index 40de8e00..7a598cc6 100644 --- a/providers/README.md +++ b/providers/README.md @@ -1,5 +1,6 @@ # OpenFeature Python Providers -Providers are responsible for performing flag evaluation. They provide an abstraction between the underlying -flag management system and OpenFeature itself. This allows providers to be changed without requiring a major -code refactor. Please see the [spec]("https://github.com/open-feature/spec/blob/main/specification/sections/02-providers.md") -for more details. + +Providers are responsible for performing flag evaluation. +They provide an abstraction between the underlying flag management system and OpenFeature itself. +This allows providers to be changed without requiring a major code refactor. +Please see the [spec](https://openfeature.dev/specification/sections/providers) for more details. diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..464bf8e2 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,84 @@ +{ + "bootstrap-sha": "1cef37c5d8c7d97ee52a8e6b71f12150063b8503", + "separate-pull-requests": true, + "release-type": "python", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "include-component-in-tag": true, + "tag-separator": "/", + "packages": { + "providers/openfeature-provider-flagd": { + "package-name": "providers/flagd", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "versioning": "default", + "extra-files": [ + "README.md" + ] + }, + "hooks/openfeature-hooks-opentelemetry": { + "package-name": "hooks/opentelemetry", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "versioning": "default", + "extra-files": [ + "README.md" + ] + } + }, + "changelog-sections": [ + { + "type": "fix", + "section": "๐Ÿ› Bug Fixes" + }, + { + "type": "feat", + "section": "โœจ New Features" + }, + { + "type": "chore", + "section": "๐Ÿงน Chore" + }, + { + "type": "docs", + "section": "๐Ÿ“š Documentation" + }, + { + "type": "perf", + "section": "๐Ÿš€ Performance" + }, + { + "type": "build", + "hidden": true, + "section": "๐Ÿ› ๏ธ Build" + }, + { + "type": "deps", + "section": "๐Ÿ“ฆ Dependencies" + }, + { + "type": "ci", + "hidden": true, + "section": "๐Ÿšฆ CI" + }, + { + "type": "refactor", + "section": "๐Ÿ”„ Refactoring" + }, + { + "type": "revert", + "section": "๐Ÿ”™ Reverts" + }, + { + "type": "style", + "hidden": true, + "section": "๐ŸŽจ Styling" + }, + { + "type": "test", + "hidden": true, + "section": "๐Ÿงช Tests" + } + ], + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" +}