Skip to content

Commit

Permalink
ci: autogenerate changelog with git-cliff
Browse files Browse the repository at this point in the history
  • Loading branch information
tombh committed Jul 2, 2023
1 parent 56d91e1 commit 8bbcbee
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 26 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release Pygls to PyPI

on:
release:
types: [published]

jobs:
relase:
name: "🚀 Release 🚢"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Python "3.10"
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Generate the latest changelog
uses: orhun/git-cliff-action@v2
id: git-cliff
with:
args: --verbose --latest
- name: Update the changelog
run: |
cat "${{ steps.git-cliff.outputs.contents }} | "sed -i "3r /dev/stdin" CHANGELOG.md
git config --global user.name 'Github Action'
git config --global user.email 'github.action@users.noreply.github.com'
git commit -am "chore: update changelog"
git push
- name: Release
run: |
poetry build
poetry publish --username "__token__" --password ${{ secrets.PYPI_API_TOKEN }}
16 changes: 8 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog][keepachangelog],
and this project adheres to [Semantic Versioning][semver].

## [Unreleased]
### Added
### Extra Notes
#### Added

- Add `LanguageClient` with LSP methods autogenerated from type annotations in `lsprotocol` ([#328])
- Add base JSON-RPC `Client` with support for running servers in a subprocess and communicating over stdio. ([#328])
- Support work done progress cancel ([#253])
- Add support for `textDocument/inlayHint` and `inlayHint/resolve` requests ([#342])

### Changed
### Fixed
#### Changed
#### Fixed

- `pygls` no longer overrides the event loop for the current thread when given an explicit loop to use. ([#334])
- Fixed `MethodTypeNotRegisteredError` when registering a `TEXT_DOCUMENT_DID_SAVE` feature with options. ([#338])
Expand All @@ -26,6 +22,10 @@ and this project adheres to [Semantic Versioning][semver].
[#342]: https://github.com/openlawlibrary/pygls/pull/342


---

# Pre Automation Changelog

## [1.0.2] - May 15th, 2023
### Changed
- Update typeguard to 3.x ([#327])
Expand Down
2 changes: 0 additions & 2 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ _Please replace this description with a concise description of this Pull Request
- [ ] Tests have been included and/or updated, as appropriate
- [ ] Docstrings have been included and/or updated, as appropriate
- [ ] Standalone docs have been updated accordingly
- [ ] Changelog has been updated, as needed (see [CHANGELOG.md][changelog])

[changelog]: https://github.com/openlawlibrary/pygls/blob/master/CHANGELOG.md
[commit messages]: https://chris.beams.io/posts/git-commit/
16 changes: 0 additions & 16 deletions RELEASING.md

This file was deleted.

64 changes: 64 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[changelog]
header = ""
# template for the changelog body
# https://tera.netlify.app/docs
body = """
{% if version %}\
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else %}\
## [unreleased]
{% endif %}\
More details: https://github.com/openlawlibrary/pygls/releases/tag/v{{version}}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
{% endfor %}
{% endfor %}\n
"""
# remove the leading and trailing whitespace from the template
trim = true
# changelog footer
footer = ""

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = false # TODO: Toggle after v1.0.3 as it introduces commit linting
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/openlawlibrary/pygls/issues/${2}))"}, # replace issue numbers
]
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "Features" },
{ message = "^fix", group = "Bug Fixes" },
{ message = "^doc", group = "Documentation" },
{ message = "^perf", group = "Performance" },
{ message = "^refactor", group = "Refactor" },
{ message = "^style", group = "Styling" },
{ message = "^test", group = "Testing" },
{ message = "^ci", group = "CI" },
{ message = "^chore\\(release\\): prepare for", skip = true },
{ message = "^chore", group = "Miscellaneous Tasks" },
{ body = ".*security", group = "Security" },
]
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
# regex for skipping tags
skip_tags = "v0.1.0-beta.1"
# regex for ignoring tags
ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
# limit the number of commits included in the changelog.
# limit_commits = 42

0 comments on commit 8bbcbee

Please sign in to comment.