diff --git a/.github_changelog_generator b/.github_changelog_generator new file mode 100644 index 0000000..4ed6c58 --- /dev/null +++ b/.github_changelog_generator @@ -0,0 +1,12 @@ +output=CHANGELOG.md +user=sdb9696 +project=firebase-messaging +release-branch=main +base=HISTORY.md +since-tag=0.2.1 +usernames-as-github-logins=true +add-sections={"docs":{"prefix":"**Documentation updates:**","labels":["documentation"]},"maintenance":{"prefix":"**Project maintenance:**","labels":["maintenance"]}} +exclude-labels=duplicate,question,invalid,wontfix,release-prep,stale,bug +issues-wo-labels=false +bug-labels=bugfix +breaking-label=**Breaking change pull requests:** diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5df234d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,83 @@ +# Changelog + +## [0.3.0](https://github.com/sdb9696/firebase-messaging/tree/0.3.0) (2024-03-26) + +[Full Changelog](https://github.com/sdb9696/firebase-messaging/compare/0.2.1...0.3.0) + +**Merged pull requests:** + +- Make checkin async [\#2](https://github.com/sdb9696/firebase-messaging/pull/2) (@sdb9696) + +## [0.2.1](https://github.com/sdb9696/firebase-messaging/releases/tag/0.2.1) - 2024-03-19 + +[Compare with 0.2.0](https://github.com/sdb9696/firebase-messaging/compare/0.2.0...0.2.1) + +### Added + +- Add typing ([ae3bc88](https://github.com/sdb9696/firebase-messaging/commit/ae3bc8821c1ca16fc6da00af0f0655851f6f848f) by sdb9696). +- Add ruff pre-commit hook ([bd98a4e](https://github.com/sdb9696/firebase-messaging/commit/bd98a4eea43ab0d63112f15f2ea3e2aa6c12f7c7) by sdb9696). +- Publisher verbose ([98cd5c4](https://github.com/sdb9696/firebase-messaging/commit/98cd5c4a40b12a42fc234d61076560a21bf46666) by sdb9696). + +### Fixed + +- Fix publisher ([6347dc2](https://github.com/sdb9696/firebase-messaging/commit/6347dc262df7f409099807df18db3e4550316106) by sdb9696). +- Fix cryptography warning in key generation ([5d4685b](https://github.com/sdb9696/firebase-messaging/commit/5d4685b9be3b66c3bff38ae6b4049094ba116ffb) by sdb9696). +- Fix broken proto file ([1bf3625](https://github.com/sdb9696/firebase-messaging/commit/1bf36259cd508bf6a58dc9f16138294aef235068) by sdb9696). + +### Merged + +- Merge pull request #1 from sdb9696/add_typing ([919eb97](https://github.com/sdb9696/firebase-messaging/commit/919eb97750dc3481130056ed6a4b9f4773b8da15) by Steven B). + +## [0.2.0](https://github.com/sdb9696/firebase-messaging/releases/tag/0.2.0) - 2023-10-31 + +[Compare with 0.1.4](https://github.com/sdb9696/firebase-messaging/compare/0.1.4...0.2.0) + +- Bump to 0.2.0, rename entry points and add run state for stability ([e3cbfda](https://github.com/sdb9696/firebase-messaging/commit/e3cbfda2f753e11029c437ec66720d836ccc0595) by sdb9696). + +### Removed + +- Remove need to be created in an event loop ([87daa6b](https://github.com/sdb9696/firebase-messaging/commit/87daa6b0078ef17131c3e64519b3042c559e3630) by sdb9696). + +## [0.1.4](https://github.com/sdb9696/firebase-messaging/releases/tag/0.1.4) - 2023-10-25 + +[Compare with 0.1.3](https://github.com/sdb9696/firebase-messaging/compare/0.1.3...0.1.4) + +- Relax protobuf dependency for HA ([9ac0bc6](https://github.com/sdb9696/firebase-messaging/commit/9ac0bc6d8212ea9a4fb4aa6cc412e7e760414dae) by sdb9696). + +## [0.1.3](https://github.com/sdb9696/firebase-messaging/releases/tag/0.1.3) - 2023-10-25 + +[Compare with 0.1.2](https://github.com/sdb9696/firebase-messaging/compare/0.1.2...0.1.3) + +- Bugfix python 3.9 async lock ([c2ee681](https://github.com/sdb9696/firebase-messaging/commit/c2ee68123ee4b8d5d62060b80ed746b2ec639b29) by sdb9696). + +## [0.1.2](https://github.com/sdb9696/firebase-messaging/releases/tag/0.1.2) - 2023-10-25 + +[Compare with 0.1.1](https://github.com/sdb9696/firebase-messaging/compare/0.1.1...0.1.2) + +### Fixed + +- Update handling of no event loop and bump version ([29f3841](https://github.com/sdb9696/firebase-messaging/commit/29f38414eba0ed5893578c382eae558a826475de) by sdb9696). + +## [0.1.1](https://github.com/sdb9696/firebase-messaging/releases/tag/0.1.1) - 2023-10-23 + +[Compare with 0.1.0](https://github.com/sdb9696/firebase-messaging/compare/0.1.0...0.1.1) + +### Fixed + +- Fix gcm checkin with credentials ([4c51098](https://github.com/sdb9696/firebase-messaging/commit/4c5109816b0d3fa266329bb36ec6fdfb02598ca3) by sdb9696). + +## [0.1.0](https://github.com/sdb9696/firebase-messaging/releases/tag/0.1.0) - 2023-10-23 + +[Compare with first commit](https://github.com/sdb9696/firebase-messaging/compare/acf9b784788d68026d64d2f6d39a23274dbd663e...0.1.0) + +### Added + +- Add tests and docs and refactor ([77c225c](https://github.com/sdb9696/firebase-messaging/commit/77c225c142f1173ca2746c7a07de250b7d46e610) by sdb9696). + +### Fixed + +- Fix publish workflow ([447d379](https://github.com/sdb9696/firebase-messaging/commit/447d37922aa2589e79b3952036ef10b02debb01a) by sdb9696). + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/CHANGELOG.rst b/CHANGELOG.rst deleted file mode 100644 index 3296f8c..0000000 --- a/CHANGELOG.rst +++ /dev/null @@ -1,3 +0,0 @@ -========= -Changelog -========= diff --git a/HISTORY.md b/HISTORY.md new file mode 100644 index 0000000..1b8571c --- /dev/null +++ b/HISTORY.md @@ -0,0 +1,69 @@ +## [0.2.1](https://github.com/sdb9696/firebase-messaging/releases/tag/0.2.1) - 2024-03-19 + +[Compare with 0.2.0](https://github.com/sdb9696/firebase-messaging/compare/0.2.0...0.2.1) + +### Added + +- Add typing ([ae3bc88](https://github.com/sdb9696/firebase-messaging/commit/ae3bc8821c1ca16fc6da00af0f0655851f6f848f) by sdb9696). +- Add ruff pre-commit hook ([bd98a4e](https://github.com/sdb9696/firebase-messaging/commit/bd98a4eea43ab0d63112f15f2ea3e2aa6c12f7c7) by sdb9696). +- Publisher verbose ([98cd5c4](https://github.com/sdb9696/firebase-messaging/commit/98cd5c4a40b12a42fc234d61076560a21bf46666) by sdb9696). + +### Fixed + +- Fix publisher ([6347dc2](https://github.com/sdb9696/firebase-messaging/commit/6347dc262df7f409099807df18db3e4550316106) by sdb9696). +- Fix cryptography warning in key generation ([5d4685b](https://github.com/sdb9696/firebase-messaging/commit/5d4685b9be3b66c3bff38ae6b4049094ba116ffb) by sdb9696). +- Fix broken proto file ([1bf3625](https://github.com/sdb9696/firebase-messaging/commit/1bf36259cd508bf6a58dc9f16138294aef235068) by sdb9696). + +### Merged + +- Merge pull request #1 from sdb9696/add_typing ([919eb97](https://github.com/sdb9696/firebase-messaging/commit/919eb97750dc3481130056ed6a4b9f4773b8da15) by Steven B). + +## [0.2.0](https://github.com/sdb9696/firebase-messaging/releases/tag/0.2.0) - 2023-10-31 + +[Compare with 0.1.4](https://github.com/sdb9696/firebase-messaging/compare/0.1.4...0.2.0) + +- Bump to 0.2.0, rename entry points and add run state for stability ([e3cbfda](https://github.com/sdb9696/firebase-messaging/commit/e3cbfda2f753e11029c437ec66720d836ccc0595) by sdb9696). + +### Removed + +- Remove need to be created in an event loop ([87daa6b](https://github.com/sdb9696/firebase-messaging/commit/87daa6b0078ef17131c3e64519b3042c559e3630) by sdb9696). + +## [0.1.4](https://github.com/sdb9696/firebase-messaging/releases/tag/0.1.4) - 2023-10-25 + +[Compare with 0.1.3](https://github.com/sdb9696/firebase-messaging/compare/0.1.3...0.1.4) + +- Relax protobuf dependency for HA ([9ac0bc6](https://github.com/sdb9696/firebase-messaging/commit/9ac0bc6d8212ea9a4fb4aa6cc412e7e760414dae) by sdb9696). + +## [0.1.3](https://github.com/sdb9696/firebase-messaging/releases/tag/0.1.3) - 2023-10-25 + +[Compare with 0.1.2](https://github.com/sdb9696/firebase-messaging/compare/0.1.2...0.1.3) + +- Bugfix python 3.9 async lock ([c2ee681](https://github.com/sdb9696/firebase-messaging/commit/c2ee68123ee4b8d5d62060b80ed746b2ec639b29) by sdb9696). + +## [0.1.2](https://github.com/sdb9696/firebase-messaging/releases/tag/0.1.2) - 2023-10-25 + +[Compare with 0.1.1](https://github.com/sdb9696/firebase-messaging/compare/0.1.1...0.1.2) + +### Fixed + +- Update handling of no event loop and bump version ([29f3841](https://github.com/sdb9696/firebase-messaging/commit/29f38414eba0ed5893578c382eae558a826475de) by sdb9696). + +## [0.1.1](https://github.com/sdb9696/firebase-messaging/releases/tag/0.1.1) - 2023-10-23 + +[Compare with 0.1.0](https://github.com/sdb9696/firebase-messaging/compare/0.1.0...0.1.1) + +### Fixed + +- Fix gcm checkin with credentials ([4c51098](https://github.com/sdb9696/firebase-messaging/commit/4c5109816b0d3fa266329bb36ec6fdfb02598ca3) by sdb9696). + +## [0.1.0](https://github.com/sdb9696/firebase-messaging/releases/tag/0.1.0) - 2023-10-23 + +[Compare with first commit](https://github.com/sdb9696/firebase-messaging/compare/acf9b784788d68026d64d2f6d39a23274dbd663e...0.1.0) + +### Added + +- Add tests and docs and refactor ([77c225c](https://github.com/sdb9696/firebase-messaging/commit/77c225c142f1173ca2746c7a07de250b7d46e610) by sdb9696). + +### Fixed + +- Fix publish workflow ([447d379](https://github.com/sdb9696/firebase-messaging/commit/447d37922aa2589e79b3952036ef10b02debb01a) by sdb9696). diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..23c0a10 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,168 @@ +# Releasing + +## Requirements +* [github client](https://github.com/cli/cli#installation) +* [gitchub_changelog_generator](https://github.com/github-changelog-generator) +* [github access token](https://github.com/github-changelog-generator/github-changelog-generator#github-token) + +## Export changelog token + +```bash +export CHANGELOG_GITHUB_TOKEN=token +``` + +## Set release information + +```bash +export NEW_RELEASE=x.x.x +``` + +## Normal releases from main + +### Create a branch for the release + +```bash +git checkout main +git fetch upstream main +git rebase upstream/main +git checkout -b release/$NEW_RELEASE +``` + +### Update the version number + +```bash +poetry version $NEW_RELEASE +``` + +### Update dependencies + +```bash +poetry install --all-extras --sync +poetry update +``` + +### Run pre-commit and tests + +```bash +pre-commit run --all-files +pytest +``` + +### Create release summary (skip for dev releases) + +Write a short and understandable summary for the release. Can include images. + +#### Create $NEW_RELEASE milestone in github + +If not already created + +#### Create new issue linked to the milestone + +```bash +gh issue create --label "release-summary" --milestone $NEW_RELEASE --title "$NEW_RELEASE Release Summary" --body "**Release highlights:**" +``` + +You can exclude the --body option to get an interactive editor or go into the issue on github and edit there. + +#### Close the issue + +Either via github or: + +```bash +gh issue close ISSUE_NUMBER +``` + +### Generate changelog + +Configuration settings are in `.github_changelog_generator` + +#### For pre-release + +EXCLUDE_TAGS will exclude all dev tags except for the current release dev tags. + +Regex should be something like this `^((?!0\.9\.0)(.*dev\d))+`. The first match group negative matches on the current release and the second matches on releases ending with dev. + +```bash +EXCLUDE_TAGS=${NEW_RELEASE%.dev*}; EXCLUDE_TAGS=${EXCLUDE_TAGS//"."/"\."}; EXCLUDE_TAGS="^((?!"$EXCLUDE_TAGS")(.*dev\d))+" +echo "$EXCLUDE_TAGS" +github_changelog_generator --future-release $NEW_RELEASE --exclude-tags-regex "$EXCLUDE_TAGS" +``` + +#### For production + +```bash +github_changelog_generator --future-release $NEW_RELEASE --exclude-tags-regex 'dev\d$' +``` + +You can ignore warnings about missing PR commits like below as these relate to PRs to branches other than main: +``` +Warning: PR 111 merge commit was not found in the release branch or tagged git history and no rebased SHA comment was found +``` + + +### Export new release notes to variable + +```bash +export RELEASE_NOTES=$(grep -Poz '(?<=\# Changelog\n\n)(.|\n)+?(?=\#\#)' CHANGELOG.md | tr '\0' '\n' ) +echo "$RELEASE_NOTES" # Check the output and copy paste if neccessary +``` + +### Commit and push the changed files + +```bash +git commit --all --verbose -m "Prepare $NEW_RELEASE" +git push upstream release/$NEW_RELEASE -u +``` + +### Create a PR for the release, merge it, and re-fetch the main + +#### Create the PR +``` +gh pr create --title "Prepare $NEW_RELEASE" --body "$RELEASE_NOTES" --label release-prep --base main +``` + +#### Merge the PR once the CI passes + +Create a squash commit and add the markdown from the PR description to the commit description. + +```bash +gh pr merge --squash --body "$RELEASE_NOTES" +``` + +### Rebase local main + +```bash +git checkout main +git fetch upstream main +git rebase upstream/main +``` + +### Create a release tag + +Note, add changelog release notes as the tag commit message so `gh release create --notes-from-tag` can be used to create a release draft. + +```bash +git tag --annotate $NEW_RELEASE -m "$RELEASE_NOTES" # to create a signed tag replace --annotate with --sign +git push upstream $NEW_RELEASE +``` + +### Create release + +N.B. the `--notes-from-tag` option requires gh cli version >= 2.35.0 + +#### Pre-releases + +```bash +gh release create "$NEW_RELEASE" --verify-tag --notes-from-tag --title "$NEW_RELEASE" --draft --latest=false --prerelease + +``` + +#### Production release + +```bash +gh release create "$NEW_RELEASE" --verify-tag --notes-from-tag --title "$NEW_RELEASE" --draft --latest=true +``` + +### Manually publish the release + +Go to the linked URL, verify the contents, and click "release" button to trigger the release CI. diff --git a/docs/source/changelog.md b/docs/source/changelog.md new file mode 100644 index 0000000..a155cbb --- /dev/null +++ b/docs/source/changelog.md @@ -0,0 +1 @@ +:::{include} ../../CHANGELOG.md diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst deleted file mode 100644 index 09929fe..0000000 --- a/docs/source/changelog.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../../CHANGELOG.rst diff --git a/docs/source/conf.py b/docs/source/conf.py index b30df1c..40d939a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,6 +23,11 @@ "sphinx.ext.coverage", "sphinx.ext.viewcode", "sphinx.ext.todo", + "myst_parser", +] + +myst_enable_extensions = [ + "colon_fence", ] templates_path = ["_templates"] diff --git a/poetry.lock b/poetry.lock index 89e5c9d..c12381e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -787,6 +787,30 @@ MarkupSafe = ">=2.0" [package.extras] i18n = ["Babel (>=2.7)"] +[[package]] +name = "markdown-it-py" +version = "3.0.0" +description = "Python port of markdown-it. Markdown parsing, done right!" +optional = true +python-versions = ">=3.8" +files = [ + {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, + {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, +] + +[package.dependencies] +mdurl = ">=0.1,<1.0" + +[package.extras] +benchmarking = ["psutil", "pytest", "pytest-benchmark"] +code-style = ["pre-commit (>=3.0,<4.0)"] +compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] +linkify = ["linkify-it-py (>=1,<3)"] +plugins = ["mdit-py-plugins"] +profiling = ["gprof2dot"] +rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + [[package]] name = "markupsafe" version = "2.1.5" @@ -856,6 +880,36 @@ files = [ {file = "MarkupSafe-2.1.5.tar.gz", hash = "sha256:d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b"}, ] +[[package]] +name = "mdit-py-plugins" +version = "0.4.1" +description = "Collection of plugins for markdown-it-py" +optional = true +python-versions = ">=3.8" +files = [ + {file = "mdit_py_plugins-0.4.1-py3-none-any.whl", hash = "sha256:1020dfe4e6bfc2c79fb49ae4e3f5b297f5ccd20f010187acc52af2921e27dc6a"}, + {file = "mdit_py_plugins-0.4.1.tar.gz", hash = "sha256:834b8ac23d1cd60cec703646ffd22ae97b7955a6d596eb1d304be1e251ae499c"}, +] + +[package.dependencies] +markdown-it-py = ">=1.0.0,<4.0.0" + +[package.extras] +code-style = ["pre-commit"] +rtd = ["myst-parser", "sphinx-book-theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + +[[package]] +name = "mdurl" +version = "0.1.2" +description = "Markdown URL utilities" +optional = true +python-versions = ">=3.7" +files = [ + {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, + {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, +] + [[package]] name = "multidict" version = "6.0.5" @@ -1028,6 +1082,32 @@ files = [ protobuf = ">=4.25.3" types-protobuf = ">=4.24" +[[package]] +name = "myst-parser" +version = "3.0.1" +description = "An extended [CommonMark](https://spec.commonmark.org/) compliant parser," +optional = true +python-versions = ">=3.8" +files = [ + {file = "myst_parser-3.0.1-py3-none-any.whl", hash = "sha256:6457aaa33a5d474aca678b8ead9b3dc298e89c68e67012e73146ea6fd54babf1"}, + {file = "myst_parser-3.0.1.tar.gz", hash = "sha256:88f0cb406cb363b077d176b51c476f62d60604d68a8dcdf4832e080441301a87"}, +] + +[package.dependencies] +docutils = ">=0.18,<0.22" +jinja2 = "*" +markdown-it-py = ">=3.0,<4.0" +mdit-py-plugins = ">=0.4,<1.0" +pyyaml = "*" +sphinx = ">=6,<8" + +[package.extras] +code-style = ["pre-commit (>=3.0,<4.0)"] +linkify = ["linkify-it-py (>=2.0,<3.0)"] +rtd = ["ipython", "sphinx (>=7)", "sphinx-autodoc2 (>=0.5.0,<0.6.0)", "sphinx-book-theme (>=1.1,<2.0)", "sphinx-copybutton", "sphinx-design", "sphinx-pyscript", "sphinx-tippy (>=0.4.3)", "sphinx-togglebutton", "sphinxext-opengraph (>=0.9.0,<0.10.0)", "sphinxext-rediraffe (>=0.2.7,<0.3.0)"] +testing = ["beautifulsoup4", "coverage[toml]", "defusedxml", "pytest (>=8,<9)", "pytest-cov", "pytest-param-files (>=0.6.0,<0.7.0)", "pytest-regressions", "sphinx-pytest"] +testing-docutils = ["pygments", "pytest (>=8,<9)", "pytest-param-files (>=0.6.0,<0.7.0)"] + [[package]] name = "nodeenv" version = "1.9.1" @@ -1701,9 +1781,9 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", type = ["pytest-mypy"] [extras] -docs = ["sphinx", "sphinx-autodoc-typehints", "sphinx-rtd-theme"] +docs = ["myst-parser", "sphinx", "sphinx-autodoc-typehints", "sphinx-rtd-theme"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "212b5f761b75880af7be06eb3b2c8fb41d926f7c536859dfd6d23f099c29f48e" +content-hash = "137532a65fa6d35852f901b3581e619fb2c58a42947aee8adff24217325af45d" diff --git a/pyproject.toml b/pyproject.toml index 5988cd6..f1d2d84 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,9 +36,10 @@ sphinx = {version = "7.1.2", optional = true} sphinx-rtd-theme = {version = "^1.3.0", optional = true} sphinx-autodoc-typehints = {version = "^1.24.0", optional = true} aiohttp = "^3.9.3" +myst-parser = {version = "*", optional = true } [tool.poetry.extras] -docs = ["sphinx", "sphinx-rtd-theme", "sphinx-autodoc-typehints"] +docs = ["sphinx", "sphinx-rtd-theme", "sphinx-autodoc-typehints", "myst-parser"] [tool.poetry.group.dev.dependencies] pre-commit = "*"