diff --git a/.github/workflows/create-github-release.yml b/.github/workflows/create-github-release.yml new file mode 100644 index 0000000..7812299 --- /dev/null +++ b/.github/workflows/create-github-release.yml @@ -0,0 +1,39 @@ +name: Create GitHub release. + +on: + workflow_dispatch: + +jobs: + create-github-release: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-python@v6 + with: + python-version: 3.13 + + - name: Install dev requirements. + run: make requirements-dev + + - name: Configure Git user. + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Read current version. + id: version + run: | + echo "CURRENT_VERSION=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT + + - name: Create and push Git tag. + env: + CURRENT_VERSION: ${{ steps.version.outputs.CURRENT_VERSION }} + run: | + git tag -am "Release $CURRENT_VERSION" "$CURRENT_VERSION" + git push origin "$CURRENT_VERSION" + + - name: Create GitHub release. + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: scriv github-release --repo=Pearson-Advance/secure-cloudfront-video diff --git a/.github/workflows/create-release-pr.yml b/.github/workflows/create-release-pr.yml new file mode 100644 index 0000000..1bb42ff --- /dev/null +++ b/.github/workflows/create-release-pr.yml @@ -0,0 +1,65 @@ +name: Create a release pull request. + +on: + workflow_dispatch: + inputs: + semver-type: + description: "Semantic version to be released." + required: true + type: choice + options: + - "major" + - "minor" + - "patch" + +jobs: + create-release-pr: + runs-on: ubuntu-latest + env: + SEMVER_TYPE: ${{ github.event.inputs.semver-type }} + + steps: + - uses: actions/checkout@v5 + - uses: actions/setup-python@v6 + with: + python-version: 3.13 + + - name: Install dev requirements. + run: make requirements-dev + + - name: Configure Git user. + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Calculate current and next version. + id: version + run: | + echo "CURRENT_VERSION=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT + echo "NEW_VERSION=$(bump-my-version show --increment $SEMVER_TYPE new_version)" >> $GITHUB_OUTPUT + + - name: Execute bump version. + run: bump-my-version bump $SEMVER_TYPE + + - name: Collect changelog entries. + run: make changelog-collect + + - name: Create pull request. + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CURRENT_VERSION: ${{ steps.version.outputs.CURRENT_VERSION }} + NEW_VERSION: ${{ steps.version.outputs.NEW_VERSION }} + run: | + git checkout -b release-$NEW_VERSION + git commit -am "chore: bump version $CURRENT_VERSION → $NEW_VERSION" + git push origin release-$NEW_VERSION + + gh pr create --base master \ + --title "$NEW_VERSION release" \ + --body " + ## Description + + This PR bumps the version from \`$CURRENT_VERSION\` to \`$NEW_VERSION\`. + + The changelog has been automatically generated using \`scriv\`. + " diff --git a/CHANGELOG.md b/CHANGELOG.md index ca8c2e8..1df3f74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ + +scriv-end-here ## Version 2.0.0 ## Description: diff --git a/Makefile b/Makefile index 1f512c0..a41d946 100644 --- a/Makefile +++ b/Makefile @@ -29,8 +29,18 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy $(PIP_COMPILE) -o requirements/pip-tools.txt requirements/pip-tools.in $(PIP_COMPILE) -o requirements/base.txt requirements/base.in $(PIP_COMPILE) -o requirements/quality.txt requirements/quality.in + $(PIP_COMPILE) -o requirements/dev.txt requirements/dev.in quality: clean ## check coding style with pycodestyle and pylint pip install -r requirements/quality.txt pycodestyle ./secure_cloudfront_video pylint ./secure_cloudfront_video --rcfile=./setup.cfg + +requirements-dev: ## install development environment requirements. + pip install -r requirements/dev.txt + +changelog-entry: requirements-dev ## Create a new changelog entry. + scriv create --edit + +changelog-collect: requirements-dev ## Collect changelog entries in the CHANGELOG.md file. + scriv collect diff --git a/changelog.d/20251119_085952_daniel.quiroga_add_automatic_release.md b/changelog.d/20251119_085952_daniel.quiroga_add_automatic_release.md new file mode 100644 index 0000000..8489361 --- /dev/null +++ b/changelog.d/20251119_085952_daniel.quiroga_add_automatic_release.md @@ -0,0 +1,60 @@ + + +### Removed + +- Bumpversion has been removed from configuration files. + + +### Added + +- Scriv support has been added to manage CHANGELOG files. +- changelog-entry and changelog commands have been added to Makefile. +- Bump-my-version has been added to improve the release process of the plugin. +- A new Github Action workflow has been added to create a PR for the release process. +- Pyproject.toml file has been added. +- A new Github Action workflow has been added to create a GH release and tag. +- New requirements dev.in & dev.txt files have been added to organize dev requirements. + + + + + + + + + diff --git a/changelog.d/scriv.ini b/changelog.d/scriv.ini new file mode 100644 index 0000000..28b185a --- /dev/null +++ b/changelog.d/scriv.ini @@ -0,0 +1,4 @@ +[scriv] +version = literal: secure_cloudfront_video/__init__.py: __version__ +format = md +new_fragment_template = file: changelog.d/scriv/new_fragment.${config:format}.j2 diff --git a/changelog.d/scriv/new_fragment.md.j2 b/changelog.d/scriv/new_fragment.md.j2 new file mode 100644 index 0000000..7b309c1 --- /dev/null +++ b/changelog.d/scriv/new_fragment.md.j2 @@ -0,0 +1,58 @@ + + + + + + + + + + + + + diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bddf0bc --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,7 @@ +[tool.bumpversion] +current_version = "3.0.0" +tag = false +commit = false + +[[tool.bumpversion.files]] +filename = "secure_cloudfront_video/__init__.py" diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 7e0b8fa..6dbc3b9 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -10,3 +10,7 @@ # Stay on the latest LTS release of Django Django<6.0 + +# Development constraints. +bump-my-version==1.2.4 +scriv==1.7.0 diff --git a/requirements/dev.in b/requirements/dev.in new file mode 100644 index 0000000..ea250ec --- /dev/null +++ b/requirements/dev.in @@ -0,0 +1,3 @@ +# Development requirements used for CI and dev tooling. +bump-my-version +scriv diff --git a/requirements/dev.txt b/requirements/dev.txt new file mode 100644 index 0000000..f4e0237 --- /dev/null +++ b/requirements/dev.txt @@ -0,0 +1,97 @@ +# +# This file is autogenerated by pip-compile with Python 3.13 +# by the following command: +# +# make upgrade +# +annotated-types==0.7.0 + # via pydantic +anyio==4.11.0 + # via httpx +attrs==25.4.0 + # via scriv +bracex==2.6 + # via wcmatch +bump-my-version==1.2.4 + # via -r requirements/dev.in +certifi==2025.11.12 + # via + # httpcore + # httpx + # requests +charset-normalizer==3.4.4 + # via requests +click==8.2.1 + # via + # bump-my-version + # click-log + # rich-click + # scriv +click-log==0.4.0 + # via scriv +h11==0.16.0 + # via httpcore +httpcore==1.0.9 + # via httpx +httpx==0.28.1 + # via bump-my-version +idna==3.11 + # via + # anyio + # httpx + # requests +jinja2==3.1.6 + # via scriv +markdown-it-py==4.0.0 + # via + # rich + # scriv +markupsafe==3.0.3 + # via jinja2 +mdurl==0.1.2 + # via markdown-it-py +prompt-toolkit==3.0.52 + # via questionary +pydantic==2.12.4 + # via + # bump-my-version + # pydantic-settings +pydantic-core==2.41.5 + # via pydantic +pydantic-settings==2.12.0 + # via bump-my-version +pygments==2.19.2 + # via rich +python-dotenv==1.2.1 + # via pydantic-settings +questionary==2.1.1 + # via bump-my-version +requests==2.32.5 + # via scriv +rich==14.2.0 + # via + # bump-my-version + # rich-click +rich-click==1.9.4 + # via bump-my-version +scriv==1.7.0 + # via -r requirements/dev.in +sniffio==1.3.1 + # via anyio +tomlkit==0.13.3 + # via bump-my-version +typing-extensions==4.15.0 + # via + # pydantic + # pydantic-core + # typing-inspection +typing-inspection==0.4.2 + # via + # pydantic + # pydantic-settings +urllib3==2.5.0 + # via requests +wcmatch==10.1 + # via bump-my-version +wcwidth==0.2.14 + # via prompt-toolkit diff --git a/setup.cfg b/setup.cfg index 95d5439..153284f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,8 +1,3 @@ -[bumpversion] -current_version = 3.0.0 -commit = True -tag = True - [pylint] ignore = CVS @@ -277,5 +272,3 @@ disable = using-cmp-argument, xrange-builtin, zip-builtin-not-iterating, - -[bumpversion:file:secure_cloudfront_video/__init__.py]