diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 049c97d..b857af1 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -34,7 +34,7 @@ jobs: - name: Build Distribution Packages run: | python setup.py bdist_wheel - - name: Install skill + - name: Install repo run: | pip install . - uses: pypa/gh-action-pip-audit@v1.0.8 diff --git a/.github/workflows/publish_stable.yml b/.github/workflows/publish_stable.yml index 83cb7b5..c7df9cb 100644 --- a/.github/workflows/publish_stable.yml +++ b/.github/workflows/publish_stable.yml @@ -1,56 +1,35 @@ -# This workflow will generate a STABLE distribution and upload it to PyPI - -name: Publish Stable Release +name: Stable Release on: push: - branches: - - master - paths-ignore: - - 'test/**' - - 'examples/**' - - '.github/**' - - '.gitignore' - - 'CHANGELOG.md' - - 'MANIFEST.in' - - 'scripts/**' + branches: [master] workflow_dispatch: jobs: - build_and_publish: + publish_stable: + uses: TigreGotico/gh-automations/.github/workflows/publish-stable.yml@master + secrets: inherit + with: + branch: 'master' + version_file: 'ovos_PHAL_plugin_mk1/version.py' + setup_py: 'setup.py' + publish_release: true + + publish_pypi: + needs: publish_stable + if: success() # Ensure this job only runs if the previous job succeeds runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 with: - ref: master + ref: dev fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. - name: Setup Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v1 with: python-version: 3.8 - name: Install Build Tools run: | python -m pip install build wheel - - name: Remove Alpha tag - run: | - python scripts/remove_alpha.py --version-file "$GITHUB_WORKSPACE/version.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 master - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Increment Version - branch: master - - name: Rebase dev on master - run: | - git config user.name "GitHub Actions" - git config user.email "actions@github.com" - git checkout dev - git rebase origin/master - git push origin dev --force-with-lease - name: version run: echo "::set-output name=version::$(python setup.py --version)" id: version @@ -66,12 +45,28 @@ jobs: Changes in this Release ${{ steps.changelog.outputs.changelog }} draft: false - prerelease: false - commitish: master + prerelease: true + commitish: dev - name: Build Distribution Packages run: | python setup.py sdist bdist_wheel - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 + - name: Publish to Test PyPI + uses: pypa/gh-action-pypi-publish@master with: password: ${{secrets.PYPI_TOKEN}} + + + sync_dev: + needs: publish_stable + if: success() # Ensure this job only runs if the previous job succeeds + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + ref: master + - name: Push master -> dev + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: dev diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml new file mode 100644 index 0000000..1b7b803 --- /dev/null +++ b/.github/workflows/release_workflow.yml @@ -0,0 +1,105 @@ +name: Release Alpha and Propose Stable + +on: + pull_request: + types: [closed] + branches: [dev] + +jobs: + publish_alpha: + uses: TigreGotico/gh-automations/.github/workflows/publish-alpha.yml@master + secrets: inherit + with: + branch: 'dev' + version_file: 'ovos_PHAL_plugin_mk1/version.py' + setup_py: 'setup.py' + update_changelog: true + publish_prerelease: true + changelog_max_issues: 100 + + publish_pypi: + needs: publish_alpha + if: success() # Ensure this job only runs if the previous job succeeds + 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: 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 sdist bdist_wheel + - name: Publish to Test PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{secrets.PYPI_TOKEN}} + + + propose_release: + needs: publish_alpha + if: success() # Ensure this job only runs if the previous job succeeds + runs-on: ubuntu-latest + steps: + - name: Checkout dev branch + uses: actions/checkout@v3 + with: + ref: dev + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.10' + + - name: Get version from setup.py + id: get_version + run: | + VERSION=$(python setup.py --version) + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Create and push new branch + run: | + git checkout -b release-${{ env.VERSION }} + git push origin release-${{ env.VERSION }} + + - name: Open Pull Request from dev to master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Variables + BRANCH_NAME="release-${{ env.VERSION }}" + BASE_BRANCH="master" + HEAD_BRANCH="release-${{ env.VERSION }}" + PR_TITLE="Release ${{ env.VERSION }}" + PR_BODY="Human review requested!" + + # Create a PR using GitHub API + curl -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token $GITHUB_TOKEN" \ + -d "{\"title\":\"$PR_TITLE\",\"body\":\"$PR_BODY\",\"head\":\"$HEAD_BRANCH\",\"base\":\"$BASE_BRANCH\"}" \ + https://api.github.com/repos/${{ github.repository }}/pulls + diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..0b8b24f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,57 @@ +# Changelog + +## [0.1.2a1](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/tree/0.1.2a1) (2024-09-09) + +[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/compare/0.1.1a1...0.1.2a1) + +**Merged pull requests:** + +- fix:pypi [\#19](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/pull/19) ([JarbasAl](https://github.com/JarbasAl)) + +## [0.1.1a1](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/tree/0.1.1a1) (2024-09-09) + +[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/compare/0.1.0a2...0.1.1a1) + +**Merged pull requests:** + +- perms? [\#18](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/pull/18) ([JarbasAl](https://github.com/JarbasAl)) +- packaging:ovos-mark1-utils\>=0.0.1 [\#17](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/pull/17) ([JarbasAl](https://github.com/JarbasAl)) + +## [0.1.0a2](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/tree/0.1.0a2) (2024-09-09) + +[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/compare/V0.0.1a5...0.1.0a2) + +**Implemented enhancements:** + +- automations [\#16](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/pull/16) ([builderjer](https://github.com/builderjer)) + +**Fixed bugs:** + +- use a thread to not block FakeBus \(eg, voice sat\) [\#14](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/pull/14) ([JarbasAl](https://github.com/JarbasAl)) + +**Closed issues:** + +- Top button handling [\#12](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/issues/12) + +**Merged pull requests:** + +- fix: update requirements [\#10](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/pull/10) ([builderjer](https://github.com/builderjer)) + +## [V0.0.1a5](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/tree/V0.0.1a5) (2024-02-17) + +[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/compare/463c90249f66ec93eac50ae5b11a076cb4bef38c...V0.0.1a5) + +**Fixed bugs:** + +- module 'collections' has no attribute 'MutableSequence' [\#6](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/issues/6) +- fix: update imports for mark1 utils [\#9](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/pull/9) ([JarbasAl](https://github.com/JarbasAl)) +- fix imports [\#7](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/pull/7) ([JarbasAl](https://github.com/JarbasAl)) + +**Merged pull requests:** + +- Update build\_tests.yml [\#4](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/pull/4) ([builderjer](https://github.com/builderjer)) +- Update \_\_init\_\_.py [\#3](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1/pull/3) ([madgrizzle](https://github.com/madgrizzle)) + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/ovos_PHAL_plugin_mk1/version.py b/ovos_PHAL_plugin_mk1/version.py new file mode 100644 index 0000000..815acd1 --- /dev/null +++ b/ovos_PHAL_plugin_mk1/version.py @@ -0,0 +1,6 @@ +# START_VERSION_BLOCK +VERSION_MAJOR = 0 +VERSION_MINOR = 1 +VERSION_BUILD = 2 +VERSION_ALPHA = 0 +# END_VERSION_BLOCK diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..bbb9554 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +ovos-plugin-manager>=0.0.24 +ovos-mark1-utils>=0.0.1 +ovos-utils>=0.0.38 +pyserial~=3.0 \ No newline at end of file diff --git a/setup.py b/setup.py index f2f001f..479eba7 100755 --- a/setup.py +++ b/setup.py @@ -1,20 +1,58 @@ #!/usr/bin/env python3 +import os +from os.path import join, dirname + from setuptools import setup +BASEDIR = os.path.abspath(os.path.dirname(__file__)) + + +def required(requirements_file): + """ Read requirements file and remove comments and empty lines. """ + with open(os.path.join(BASEDIR, requirements_file), 'r') as f: + requirements = f.read().splitlines() + if 'MYCROFT_LOOSE_REQUIREMENTS' in os.environ: + print('USING LOOSE REQUIREMENTS!') + requirements = [r.replace('==', '>=').replace('~=', '>=') for r in requirements] + return [pkg for pkg in requirements + if pkg.strip() and not pkg.startswith("#")] + + +def get_version(): + """ Find the version of this skill""" + version_file = join(BASEDIR, 'ovos_PHAL_plugin_mk1/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 int(alpha): + version += f"a{alpha}" + return version + + PLUGIN_ENTRY_POINT = 'ovos-phal-mk1=ovos_PHAL_plugin_mk1:MycroftMark1' setup( name='ovos-PHAL-plugin-mk1', - version='0.0.1a5', + version=get_version(), description='A PHAL plugin for mycroft', url='https://github.com/OpenVoiceOS/ovos-PHAL-plugin-mk1', author='JarbasAi', author_email='jarbasai@mailfence.com', license='Apache-2.0', packages=['ovos_PHAL_plugin_mk1'], - install_requires=["ovos-plugin-manager>=0.0.24", - "ovos-mark1-utils>=0.0.0a2", - "ovos-utils>=0.0.38", - "pyserial~=3.0"], + install_requires=required("requirements.txt"), zip_safe=True, classifiers=[ 'Development Status :: 3 - Alpha',