From 6da45e40d05b2797aa8ac389850ea4c665fff3ad Mon Sep 17 00:00:00 2001 From: Antony Milne <49395058+antonymilne@users.noreply.github.com> Date: Wed, 25 Oct 2023 18:13:25 +0100 Subject: [PATCH] Tidy changelog and release process (#122) --- .github/workflows/check-release.yml | 2 +- .github/workflows/lint-vizro-core.yml | 9 ++-- .../20231025_154920_antony.milne_scriv.md | 42 +++++++++++++++++++ .../docs/pages/development/contributing.md | 2 +- vizro-core/hatch.toml | 24 +++++------ 5 files changed, 58 insertions(+), 21 deletions(-) create mode 100644 vizro-core/changelog.d/20231025_154920_antony.milne_scriv.md diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml index de4252b79..53d8eaca3 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check-release.yml @@ -107,7 +107,7 @@ jobs: cd "${{ needs.check-version.outputs.package_name }}" git checkout -b "release/version_bump_next_minor/${formatted_date}" hatch version patch,dev - hatch run docs:changelog + hatch run changelog:add hatch run schema hatch run lint || hatch run lint git config user.email "145135826+vizro-svc@users.noreply.github.com" diff --git a/.github/workflows/lint-vizro-core.yml b/.github/workflows/lint-vizro-core.yml index 3c2e04f81..76754e2cc 100644 --- a/.github/workflows/lint-vizro-core.yml +++ b/.github/workflows/lint-vizro-core.yml @@ -50,14 +50,11 @@ jobs: run: hatch run all.py${{ matrix.python-version }}:schema --check - name: Check requirements for Snyk are up to date - run: | - pwd - hatch run all.py${{ matrix.python-version }}:update-snyk-requirements --check + run: hatch run all.py${{ matrix.python-version }}:update-snyk-requirements --check - name: Find added changelog fragments id: added-files run: | - pwd if ${{ github.event_name == 'pull_request' }}; then echo "added_files=$(git diff --name-only --diff-filter=A -r HEAD^1 HEAD -- changelog.d/*.md | xargs)" >> $GITHUB_OUTPUT else @@ -68,9 +65,9 @@ jobs: run: | if [ -z "${{ steps.added-files.outputs.added_files }}" ]; then - echo "No changelog fragment .md file within changelog.d was detected. Run 'hatch run docs:changelog' to create such a fragment."; + echo "No changelog fragment .md file within changelog.d was detected. Run 'hatch run changelog:add' to create such a fragment."; echo "If your PR contains changes that should be mentioned in the CHANGELOG in the next release, please uncomment the relevant section in your created fragment and describe the changes to the user." - echo "If your changes are not relevant for the CHANGELOG, please save and commit the file as." + echo "If your changes are not relevant for the CHANGELOG, please save and commit the file as is." exit 1 else echo "${{ steps.added-files.outputs.added_files }} was added - ready to go!"; diff --git a/vizro-core/changelog.d/20231025_154920_antony.milne_scriv.md b/vizro-core/changelog.d/20231025_154920_antony.milne_scriv.md new file mode 100644 index 000000000..d57e34cc2 --- /dev/null +++ b/vizro-core/changelog.d/20231025_154920_antony.milne_scriv.md @@ -0,0 +1,42 @@ + + + + + + + + diff --git a/vizro-core/docs/pages/development/contributing.md b/vizro-core/docs/pages/development/contributing.md index 89dadbb2f..ecf432fce 100644 --- a/vizro-core/docs/pages/development/contributing.md +++ b/vizro-core/docs/pages/development/contributing.md @@ -155,7 +155,7 @@ a changelog fragment has been created in the folder `changelog.d`. This fragment You can easily create such a fragment by running ```bash -hatch run docs:changelog +hatch run changelog:add ``` Please begin by uncommenting the relevant section(s) you wish to describe. If your PR includes changes that are not relevant to `CHANGELOG.md`, please leave everything commented out. If you are uncertain about what to add or whether to add anything, please refer to [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). The rule of thumb should be, if in doubt, or if the user is affected in any way, it should be described in the `CHANGELOG.md`. diff --git a/vizro-core/hatch.toml b/vizro-core/hatch.toml index da34010a1..903e3d01b 100644 --- a/vizro-core/hatch.toml +++ b/vizro-core/hatch.toml @@ -8,6 +8,11 @@ matrix.python.features = [ {value = "kedro", if = ["3.8", "3.9", "3.10"]} ] +[envs.changelog] +dependencies = ["scriv"] +detached = true +scripts = {add = "scriv create --add"} + [envs.default] dependencies = [ "devtools[pygments]", @@ -37,20 +42,16 @@ cov-report = [ ] example = "cd examples/{args:default}; python app.py" lint = "SKIP=gitleaks pre-commit run {args} --all-files" -post-release = [ - "hatch version patch,dev", - "echo 'Raise a PR to bump to the new development version'" -] prep-release = [ "hatch version release", - "hatch run docs:scriv collect", + "hatch run changelog:scriv collect --add", "rm -rf schemas/*json", - "hatch run schema", + "schema", "hatch run lint || hatch run lint", - "hatch run docs:changelog", - "echo 'Raise a PR to prepare main for release'" + "hatch run changelog:add", + 'echo "Now raise a PR to merge into main with title: Release of vizro-core $(hatch version)"' ] -pypath = "hatch run python -c 'import sys; print(sys.executable)'" +pypath = "python -c 'import sys; print(sys.executable)'" schema = "python schemas/generate.py {args}" secrets = "pre-commit run gitleaks --all-files" test = [ @@ -77,10 +78,7 @@ dependencies = [ "scriv" ] detached = true - -[envs.docs.scripts] -changelog = "scriv create" -serve = "mkdocs serve" +scripts = {serve = "mkdocs serve"} [publish.index] disable = true