diff --git a/.chglog/CHANGELOG.md.tpl b/.chglog/CHANGELOG.md.tpl deleted file mode 100644 index d3b51aa..0000000 --- a/.chglog/CHANGELOG.md.tpl +++ /dev/null @@ -1,31 +0,0 @@ -{{ range .Versions -}} - - -## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }}) - -{{ range .CommitGroups -}} -### {{ .Title }} - -{{ range .Commits -}} -- {{ .Subject }} -{{ end }} -{{ end -}} - -{{- if .RevertCommits -}} -### Reverts - -{{ range .RevertCommits -}} -- {{ .Revert.Header }} -{{ end }} -{{ end -}} - -{{- if .NoteGroups -}} -{{ range .NoteGroups -}} -### {{ .Title }} - -{{ range .Notes }} -{{ .Body }} -{{ end }} -{{ end -}} -{{ end -}} -{{ end -}} diff --git a/.chglog/config.yml b/.chglog/config.yml deleted file mode 100644 index a61d73b..0000000 --- a/.chglog/config.yml +++ /dev/null @@ -1,23 +0,0 @@ -style: github -template: CHANGELOG.md.tpl -info: - title: CHANGELOG - repository_url: https://github.com/lukecyca/pyzabbix -options: - commits: - filters: - Type: - - feat - - fix - commit_groups: - title_maps: - feat: ":rocket: Features" - fix: ":bug: Bug Fixes" - header: - pattern: "^(\\w*)\\:\\s(.*)$" - pattern_maps: - - Type - - Subject - notes: - keywords: - - BREAKING CHANGE diff --git a/.github/release-please-config.json b/.github/release-please-config.json new file mode 100644 index 0000000..7ea4a00 --- /dev/null +++ b/.github/release-please-config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "bootstrap-sha": "f962fef7dc6d573cf6dbc54dff5a22f7f38414c9", + "include-component-in-tag": false, + "packages": { + ".": { + "release-type": "python", + "package-name": "pyzabbix" + } + } +} diff --git a/.github/release-please-manifest.json b/.github/release-please-manifest.json new file mode 100644 index 0000000..c17c08f --- /dev/null +++ b/.github/release-please-manifest.json @@ -0,0 +1 @@ +{".":"1.3.0"} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..b56155c --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,16 @@ +name: Release please + +on: + push: + branches: [master] + +jobs: + release-please: + if: github.repository == 'lukecyca/pyzabbix' + + runs-on: ubuntu-latest + steps: + - uses: google-github-actions/release-please-action@v4 + with: + config-file: .github/release-please-config.json + manifest-file: .github/release-please-manifest.json diff --git a/.hgtags b/.hgtags deleted file mode 100644 index 030ff51..0000000 --- a/.hgtags +++ /dev/null @@ -1,2 +0,0 @@ -5211cf05c2f81c064e08075cdd2689760df0f7d1 0.1 -c70d2bb0ade06f5dbfb40a382a7bc17ad3d62bbc 0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 41c715a..720208f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,6 +28,7 @@ repos: hooks: - id: prettier files: \.(md|yml|yaml|json)$ + exclude: (\.github/release-please-manifest\.json|CHANGELOG\.md)$ - repo: https://github.com/codespell-project/codespell rev: v2.2.5 diff --git a/CHANGELOG.md b/CHANGELOG.md index ff62dbb..a48301f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +# Changelog + ## [1.3.0](https://github.com/lukecyca/pyzabbix/compare/1.2.1...1.3.0) (2023-04-08) diff --git a/Makefile b/Makefile index 00d07a7..ccf99af 100644 --- a/Makefile +++ b/Makefile @@ -44,14 +44,5 @@ e2e: $(VENV) build: $(VENV) $(VENV)/bin/python -m build . -release: - ./scripts/release.sh - -changelog: - git-chglog --output CHANGELOG.md 1.1.0.. - if command -v npx > /dev/null; then npx prettier --write CHANGELOG.md; fi - git add CHANGELOG.md - git commit -m "docs: regenerate changelog" - clean: rm -Rf $(VENV) dist diff --git a/README.md b/README.md index 5555d25..5dcbb76 100644 --- a/README.md +++ b/README.md @@ -128,20 +128,6 @@ make install source .venv/bin/activate ``` -### Releases - -To release a new version, first bump the version number in `setup.py` by hand and run the release target: - -```sh -make release -``` - -Finally, push the release commit and tag to publish them to Pypi: - -```sh -git push --follow-tags -``` - ## License LGPL 2.1 http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100755 index 698494d..0000000 --- a/scripts/release.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -set -u - -error() { - echo >&2 "error: $*" - exit 1 -} - -# This scripts will: -# - Expect the setup.py file to have new version -# - Stash the setup.py file -# - Check for clean state (no uncommitted changes), exit if failed -# - Clean the project -# - Install the project, lint and runt tests, exit if failed -# - Unstash the pyproject version bump and commit a new Release -# - Tag the new release -# - Show instruction to push tags and changes to github - -command -v make > /dev/null || error "make command not found!" -command -v git > /dev/null || error "git command not found!" -command -v python3 > /dev/null || error "python3 command not found!" - -setup="setup.py" -default_branch="master" - -[[ "$(git rev-parse --show-toplevel)" == "$(pwd)" ]] || error "please go to the project root directory!" -[[ "$(git rev-parse --abbrev-ref HEAD)" == "$default_branch" ]] || error "please change to the $default_branch git branch!" - -pkg_version=$(python3 setup.py --version || error "could not determine package version in $setup!") -git_version=$(git describe --abbrev=0 --tags || error "could not determine git version!") - -# No version change -if [[ "$pkg_version" == "$git_version" ]]; then - echo "Latest git tag '$pkg_version' and package version '$git_version' match, edit your $setup to change the version before running this script!" - exit -fi - -git stash push --quiet -- "$setup" -trap 'e=$?; git stash pop --quiet; exit $e' EXIT - -[[ -z "$(git status --porcelain)" ]] || error "please commit or clean the changes before running this script!" - -git clean -xdf - -make lint test || error "tests failed, please correct the errors" - -new_tag="$pkg_version" -release="chore: release $new_tag" - -git stash pop --quiet -git add "$setup" || error "could not stage $setup!" -git commit -m "$release" --no-verify || error "could not commit the version bump!" -git tag "$new_tag" -a -m "$release" || error "could not tag the version bump!" - -echo "Run 'git push --follow-tags' in order to publish the release on Github!"