From ed3d068321c30aa18ae8f0265bc789562cf93a86 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 Jun 2023 21:31:18 -0500 Subject: [PATCH] Update Changelog (#21) * Increment Version Co-authored-by: Mike Gray --- .github/workflows/license_tests.yml | 4 +- .github/workflows/propose_release.yml | 32 +++++++++++ .github/workflows/publish_alpha.yml | 69 +++++------------------- .github/workflows/publish_build.yml | 77 --------------------------- .github/workflows/publish_release.yml | 13 +++++ CHANGELOG.md | 23 ++------ scripts/bump_alpha.py | 18 ------- scripts/bump_build.py | 21 -------- scripts/bump_major.py | 27 ---------- scripts/bump_minor.py | 24 --------- setup.py | 34 ++++++++---- version.py | 5 +- 12 files changed, 95 insertions(+), 252 deletions(-) create mode 100644 .github/workflows/propose_release.yml delete mode 100644 .github/workflows/publish_build.yml create mode 100644 .github/workflows/publish_release.yml delete mode 100644 scripts/bump_alpha.py delete mode 100644 scripts/bump_build.py delete mode 100644 scripts/bump_major.py delete mode 100644 scripts/bump_minor.py diff --git a/.github/workflows/license_tests.yml b/.github/workflows/license_tests.yml index a284db6..7d0c4f6 100644 --- a/.github/workflows/license_tests.yml +++ b/.github/workflows/license_tests.yml @@ -2,7 +2,9 @@ name: Run License Tests on: push: workflow_dispatch: - + pull_request: + branches: + - master jobs: license_tests: uses: neongeckocom/.github/.github/workflows/license_tests.yml@master diff --git a/.github/workflows/propose_release.yml b/.github/workflows/propose_release.yml new file mode 100644 index 0000000..b496de0 --- /dev/null +++ b/.github/workflows/propose_release.yml @@ -0,0 +1,32 @@ +name: Propose Stable Release +on: + workflow_dispatch: + inputs: + release_type: + type: choice + description: Release Type + options: + - build + - minor + - major +jobs: + update_version: + uses: neongeckocom/.github/.github/workflows/propose_semver_release.yml@master + with: + release_type: ${{ inputs.release_type }} + version_file: version.py + alpha_var: VERSION_ALPHA + build_var: VERSION_BUILD + minor_var: VERSION_MINOR + major_var: VERSION_MAJOR + update_changelog: True + branch: dev + + pull_changes: + needs: update_version + uses: neongeckocom/.github/.github/workflows/pull_master.yml@master + with: + pr_assignee: ${{ github.actor }} + pr_draft: false + pr_title: ${{ needs.update_version.outputs.version }} + pr_body: ${{ needs.update_version.outputs.changelog }} diff --git a/.github/workflows/publish_alpha.yml b/.github/workflows/publish_alpha.yml index 59224fb..8f8a79a 100644 --- a/.github/workflows/publish_alpha.yml +++ b/.github/workflows/publish_alpha.yml @@ -8,67 +8,26 @@ on: paths-ignore: - "version.py" - "test/**" - - "examples/**" - ".github/**" - ".gitignore" - "LICENSE" - "CHANGELOG.md" - "MANIFEST.in" - - "readme.md" + - "skill.json" + - "README.md" - "scripts/**" workflow_dispatch: jobs: - build_and_publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: dev - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Increment Version - run: | - VER=$(python setup.py --version) - python scripts/bump_alpha.py - - name: "Generate release changelog" - uses: heinrichreimer/github-changelog-generator-action@v2.3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - maxIssues: 50 - id: changelog - - name: Commit to dev - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Increment Version - branch: dev - - name: version - run: echo "::set-output name=version::$(python setup.py --version)" - id: version - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: V${{ steps.version.outputs.version }} - release_name: Release ${{ steps.version.outputs.version }} - body: | - Changes in this Release - ${{ steps.changelog.outputs.changelog }} - draft: false - prerelease: true - commitish: dev - - name: Build Distribution Packages - run: | - python setup.py bdist_wheel - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{secrets.PYPI_TOKEN}} + publish_alpha_release: + uses: neongeckocom/.github/.github/workflows/publish_alpha_release.yml@master + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + with: + version_file: "version.py" + publish_prerelease: true + update_changelog: true + alpha_var: VERSION_ALPHA + build_var: VERSION_BUILD + minor_var: VERSION_MINOR + major_var: VERSION_MAJOR diff --git a/.github/workflows/publish_build.yml b/.github/workflows/publish_build.yml deleted file mode 100644 index 439e826..0000000 --- a/.github/workflows/publish_build.yml +++ /dev/null @@ -1,77 +0,0 @@ -# This workflow will generate a distribution and upload it to PyPI - -name: Publish Build Release ..X -on: - workflow_dispatch: - -jobs: - build_and_publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: dev - fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - - name: Setup Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install Build Tools - run: | - python -m pip install build wheel - - name: Remove alpha (declare stable) - run: | - VER=$(python setup.py --version) - python scripts/remove_alpha.py - - name: "Generate release changelog" - uses: heinrichreimer/github-changelog-generator-action@v2.3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - id: changelog - - name: Commit to dev - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Declare alpha stable - branch: dev - - name: Push dev -> master - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: master - force: true - - name: version - run: echo "::set-output name=version::$(python setup.py --version)" - id: version - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: V${{ steps.version.outputs.version }} - release_name: Release ${{ steps.version.outputs.version }} - body: | - Changes in this Release - ${{ steps.changelog.outputs.changelog }} - draft: false - prerelease: false - commitish: dev - - name: Build Distribution Packages - run: | - python setup.py bdist_wheel - - name: Prepare next Build version - run: echo "::set-output name=version::$(python setup.py --version)" - id: alpha - - name: Increment Version ${{ steps.alpha.outputs.version }}Alpha0 - run: | - VER=$(python setup.py --version) - python scripts/bump_build.py - - name: Commit to dev - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Prepare Next Version - branch: dev - - name: Publish to Test PyPI - uses: pypa/gh-action-pypi-publish@master - with: - password: ${{secrets.PYPI_TOKEN}} diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml new file mode 100644 index 0000000..c86812b --- /dev/null +++ b/.github/workflows/publish_release.yml @@ -0,0 +1,13 @@ +# This workflow will generate a release distribution and upload it to PyPI + +name: Publish Build and GitHub Release +on: + push: + branches: + - master + +jobs: + build_and_publish_pypi_and_release: + uses: neongeckocom/.github/.github/workflows/publish_stable_release.yml@master + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index c1b1096..2478564 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,12 @@ # Changelog -## [Unreleased](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/tree/HEAD) +## [0.1.1a1](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/tree/0.1.1a1) (2023-06-22) -[Full Changelog](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/compare/v0.1.0...HEAD) +[Full Changelog](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/compare/v0.1.0...0.1.1a1) -**Fixed bugs:** +**Merged pull requests:** -- fix: missed one for grandma mode [\#19](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/pull/19) ([mikejgray](https://github.com/mikejgray)) +- fix: release automation [\#20](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/pull/20) ([mikejgray](https://github.com/mikejgray)) ## [v0.1.0](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/tree/v0.1.0) (2023-06-03) @@ -63,21 +63,6 @@ - failed to initialize [\#5](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/issues/5) -## [0.0.1](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/tree/0.0.1) (2023-05-09) - -[Full Changelog](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/compare/e3466f453d59f97089892bf95e63a07a81e10faf...0.0.1) - -**Closed issues:** - -- "What would bender say?" [\#4](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/issues/4) -- Vocabs identical [\#3](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/issues/3) - -**Merged pull requests:** - -- modernization [\#7](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/pull/7) ([mikejgray](https://github.com/mikejgray)) -- Create rule0.dialog [\#2](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/pull/2) ([WalterKlosse](https://github.com/WalterKlosse)) -- German Translate [\#1](https://github.com/OpenVoiceOS/ovos-skill-easter-eggs/pull/1) ([gras64](https://github.com/gras64)) - \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/scripts/bump_alpha.py b/scripts/bump_alpha.py deleted file mode 100644 index e32996e..0000000 --- a/scripts/bump_alpha.py +++ /dev/null @@ -1,18 +0,0 @@ -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") -version_var_name = "VERSION_ALPHA" - -with open(version_file, "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith(version_var_name): - version = int(line.split("=")[-1]) - new_version = int(version) + 1 - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(version_var_name): - print(f"{version_var_name} = {new_version}") - else: - print(line.rstrip("\n")) diff --git a/scripts/bump_build.py b/scripts/bump_build.py deleted file mode 100644 index 0639896..0000000 --- a/scripts/bump_build.py +++ /dev/null @@ -1,21 +0,0 @@ -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") -version_var_name = "VERSION_BUILD" -alpha_var_name = "VERSION_ALPHA" - -with open(version_file, "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith(version_var_name): - version = int(line.split("=")[-1]) - new_version = int(version) + 1 - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(version_var_name): - print(f"{version_var_name} = {new_version}") - elif line.startswith(alpha_var_name): - print(f"{alpha_var_name} = 0") - else: - print(line.rstrip("\n")) diff --git a/scripts/bump_major.py b/scripts/bump_major.py deleted file mode 100644 index b9da0b5..0000000 --- a/scripts/bump_major.py +++ /dev/null @@ -1,27 +0,0 @@ -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") -version_var_name = "VERSION_MAJOR" -minor_var_name = "VERSION_MINOR" -build_var_name = "VERSION_BUILD" -alpha_var_name = "VERSION_ALPHA" - -with open(version_file, "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith(version_var_name): - version = int(line.split("=")[-1]) - new_version = int(version) + 1 - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(version_var_name): - print(f"{version_var_name} = {new_version}") - elif line.startswith(minor_var_name): - print(f"{minor_var_name} = 0") - elif line.startswith(build_var_name): - print(f"{build_var_name} = 0") - elif line.startswith(alpha_var_name): - print(f"{alpha_var_name} = 0") - else: - print(line.rstrip("\n")) diff --git a/scripts/bump_minor.py b/scripts/bump_minor.py deleted file mode 100644 index 033b88e..0000000 --- a/scripts/bump_minor.py +++ /dev/null @@ -1,24 +0,0 @@ -import fileinput -from os.path import join, dirname - - -version_file = join(dirname(dirname(__file__)), "version.py") -version_var_name = "VERSION_MINOR" -build_var_name = "VERSION_BUILD" -alpha_var_name = "VERSION_ALPHA" - -with open(version_file, "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith(version_var_name): - version = int(line.split("=")[-1]) - new_version = int(version) + 1 - -for line in fileinput.input(version_file, inplace=True): - if line.startswith(version_var_name): - print(f"{version_var_name} = {new_version}") - elif line.startswith(build_var_name): - print(f"{build_var_name} = 0") - elif line.startswith(alpha_var_name): - print(f"{alpha_var_name} = 0") - else: - print(line.rstrip("\n")) diff --git a/setup.py b/setup.py index 4efc775..5ebafb1 100644 --- a/setup.py +++ b/setup.py @@ -30,6 +30,30 @@ BASE_PATH = path.abspath(path.dirname(__file__)) +def get_version(): + """Find the version of the package""" + version = None + version_file = "version.py" + major, minor, build, alpha = (None, None, None, None) + with open(version_file) as f: + for line in f: + if "VERSION_MAJOR" in line: + major = line.split("=")[1].strip() + elif "VERSION_MINOR" in line: + minor = line.split("=")[1].strip() + elif "VERSION_BUILD" in line: + build = line.split("=")[1].strip() + elif "VERSION_ALPHA" in line: + alpha = line.split("=")[1].strip() + + if (major and minor and build and alpha) or "# END_VERSION_BLOCK" in line: + break + version = f"{major}.{minor}.{build}" + if alpha and int(alpha) > 0: + version += f"a{alpha}" + return version + + def get_requirements(requirements_filename: str): requirements_file = path.join(BASE_PATH, requirements_filename) with open(requirements_file, "r", encoding="utf-8") as r: @@ -63,17 +87,9 @@ def find_resource_files(): with open(path.join(BASE_PATH, "README.md"), "r") as f: long_description = f.read() -with open(path.join(BASE_PATH, "version.py"), "r", encoding="utf-8") as v: - for line in v.readlines(): - if line.startswith("__version__"): - if '"' in line: - version = line.split('"')[1] - else: - version = line.split("'")[1] - setup( name=f"{SKILL_NAME}", - version=version, + version=get_version(), url=f"https://github.com/OpenVoiceOS/{SKILL_NAME}", license="BSD-3-Clause", install_requires=get_requirements("requirements.txt"), diff --git a/version.py b/version.py index b0548b6..5e345fe 100644 --- a/version.py +++ b/version.py @@ -1 +1,4 @@ -__version__ = "0.1.0a4" +VERSION_MAJOR = 0 +VERSION_MINOR = 1 +VERSION_BUILD = 1 +VERSION_ALPHA = 0