diff --git a/.github/workflows/publish_alpha.yml b/.github/workflows/publish_alpha.yml deleted file mode 100644 index b7219ba..0000000 --- a/.github/workflows/publish_alpha.yml +++ /dev/null @@ -1,137 +0,0 @@ -# This workflow will generate an ALPHA release distribution and upload it to PyPI -name: Publish Alpha Build -on: - pull_request: - types: [closed] - branches: - - dev - paths-ignore: - - 'version.py' - - 'test/**' - - 'examples/**' - - '.github/**' - - '.gitignore' - - 'LICENSE' - - 'CHANGELOG.md' - - 'MANIFEST.in' - - 'README.md' - - 'scripts/**' - -jobs: - build_and_publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - ref: dev - fetch-depth: 0 # Avoid errors when 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: Debug GitHub Labels - run: | - echo "Labels in Pull Request:" - echo "${{ toJson(github.event.pull_request.labels) }}" - - # Convert the labels array into text using jq - LABELS=$(echo '${{ toJson(github.event.pull_request.labels) }}' | jq -r '.[].name') - - # Handle the case where there are no labels - if [ -z "$LABELS" ]; then - echo "No labels found on the pull request." - else - echo "Labels: $LABELS" - fi - - - name: Determine version bump - id: version_bump - run: | - # Convert the labels array into text using jq - LABELS=$(echo '${{ toJson(github.event.pull_request.labels) }}' | jq -r '.[].name') - - # Handle the case where there are no labels - if [ -z "$LABELS" ]; then - echo "No labels found on the pull request." - LABELS="" - fi - - echo "Labels: $LABELS" - - MAJOR=0 - MINOR=0 - BUILD=0 - - # Loop over the labels and determine the version bump - for label in $LABELS; do - echo "Processing label: $label" - if [ "$label" == "breaking" ]; then - MAJOR=1 - elif [ "$label" == "feature" ]; then - MINOR=1 - elif [ "$label" == "fix" ]; then - BUILD=1 - fi - done - - # Set the output based on the labels found - if [ $MAJOR -eq 1 ]; then - echo "::set-output name=part::major" - elif [ $MINOR -eq 1 ]; then - echo "::set-output name=part::minor" - elif [ $BUILD -eq 1 ]; then - echo "::set-output name=part::build" - else - echo "::set-output name=part::alpha" - fi - - - name: Update version in version.py - run: | - python scripts/update_version.py ${{ steps.version_bump.outputs.part }} --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 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 sdist bdist_wheel - - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{secrets.PYPI_TOKEN}} diff --git a/.github/workflows/publish_stable.yml b/.github/workflows/publish_stable.yml index 1194935..c9393e7 100644 --- a/.github/workflows/publish_stable.yml +++ b/.github/workflows/publish_stable.yml @@ -1,27 +1,27 @@ -# 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: '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@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@v1 @@ -30,27 +30,6 @@ jobs: - 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 \ No newline at end of file diff --git a/.github/workflows/release_workflow.yml b/.github/workflows/release_workflow.yml new file mode 100644 index 0000000..f21dacd --- /dev/null +++ b/.github/workflows/release_workflow.yml @@ -0,0 +1,122 @@ +name: Release Alpha and Propose Stable + +on: + pull_request: + types: [closed] + branches: [dev] + +jobs: + publish_alpha: + if: github.event.pull_request.merged == true + uses: TigreGotico/gh-automations/.github/workflows/publish-alpha.yml@master + secrets: inherit + with: + branch: 'dev' + version_file: 'version.py' + setup_py: 'setup.py' + update_changelog: true + publish_prerelease: true + changelog_max_issues: 100 + + notify: + if: github.event.pull_request.merged == true + needs: publish_alpha + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Send message to Matrix bots channel + id: matrix-chat-message + uses: fadenb/matrix-chat-message@v0.0.6 + with: + homeserver: 'matrix.org' + token: ${{ secrets.MATRIX_TOKEN }} + channel: '!WjxEKjjINpyBRPFgxl:krbel.duckdns.org' + message: | + new ${{ github.event.repository.name }} PR merged! https://github.com/${{ github.repository }}/pull/${{ github.event.number }} + + 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 index 2410e36..2a2ed2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,35 +1,12 @@ # Changelog -## [V0.1.1a1](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/tree/V0.1.1a1) (2024-09-06) +## [0.1.1a1](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/tree/0.1.1a1) (2024-09-10) -[Full Changelog](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/compare/V0.0.1...V0.1.1a1) +[Full Changelog](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/compare/V0.1.1...0.1.1a1) **Merged pull requests:** -- fix:raw\_urls [\#14](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/pull/14) ([JarbasAl](https://github.com/JarbasAl)) - -## [V0.0.1](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/tree/V0.0.1) (2024-09-02) - -[Full Changelog](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/compare/0c36f8d6b01e7b4f5152920b9c4472fc26fad4ed...V0.0.1) - -**Implemented enhancements:** - -- modernize [\#5](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/pull/5) ([NeonJarbas](https://github.com/NeonJarbas)) - -**Closed issues:** - -- Plug-in as requirement? [\#7](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/issues/7) -- Skil does not work [\#6](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/issues/6) -- No module named 'mycroft\_bus\_client' [\#3](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/issues/3) - -**Merged pull requests:** - -- Create Italian translation [\#12](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/pull/12) ([airon90](https://github.com/airon90)) -- fix/remove unused cache leftovers [\#11](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/pull/11) ([JarbasAl](https://github.com/JarbasAl)) -- refactor/ocp\_modernize [\#9](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/pull/9) ([JarbasAl](https://github.com/JarbasAl)) -- modernize for core 0.0.8 [\#4](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/pull/4) ([NeonJarbas](https://github.com/NeonJarbas)) -- feat/runtime\_requirements [\#2](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/pull/2) ([JarbasAl](https://github.com/JarbasAl)) -- Loosen ovos\_workshop dependency to support current version [\#1](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/pull/1) ([NeonDaniel](https://github.com/NeonDaniel)) +- chore:automations [\#15](https://github.com/OpenVoiceOS/skill-ovos-youtube-music/pull/15) ([JarbasAl](https://github.com/JarbasAl)) diff --git a/scripts/remove_alpha.py b/scripts/remove_alpha.py deleted file mode 100644 index fa4d09b..0000000 --- a/scripts/remove_alpha.py +++ /dev/null @@ -1,27 +0,0 @@ -""" -on merge to master -> declare stable (remove alpha) -""" -import argparse -import fileinput -import sys -from os.path import abspath, join, dirname - - -def update_alpha(version_file): - alpha_var_name = "VERSION_ALPHA" - - for line in fileinput.input(version_file, inplace=True): - if line.startswith(alpha_var_name): - print(f"{alpha_var_name} = 0") - else: - print(line.rstrip('\n')) - - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description='Update the version based on the specified part (major, minor, build, alpha)') - parser.add_argument('--version-file', help='Path to the version.py file', required=True) - - args = parser.parse_args() - - update_alpha(abspath(args.version_file)) diff --git a/scripts/update_version.py b/scripts/update_version.py deleted file mode 100644 index 188eaa1..0000000 --- a/scripts/update_version.py +++ /dev/null @@ -1,66 +0,0 @@ -""" -on merge to dev: -- depending on labels (conventional commits) script is called with "major", "minor", "build", "alpha" -- on merge to dev, update version.py string to enforce semver -""" - -import sys -import argparse -from os.path import abspath - -def read_version(version_file): - VERSION_MAJOR = 0 - VERSION_MINOR = 0 - VERSION_BUILD = 0 - VERSION_ALPHA = 0 - - with open(version_file, 'r') as file: - content = file.read() - for l in content.split("\n"): - l = l.strip() - if l.startswith("VERSION_MAJOR"): - VERSION_MAJOR = int(l.split("=")[-1]) - elif l.startswith("VERSION_MINOR"): - VERSION_MINOR = int(l.split("=")[-1]) - elif l.startswith("VERSION_BUILD"): - VERSION_BUILD = int(l.split("=")[-1]) - elif l.startswith("VERSION_ALPHA"): - VERSION_ALPHA = int(l.split("=")[-1]) - return VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_ALPHA - - -def update_version(part, version_file): - VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_ALPHA = read_version(version_file) - - if part == 'major': - VERSION_MAJOR += 1 - VERSION_MINOR = 0 - VERSION_BUILD = 0 - VERSION_ALPHA = 1 - elif part == 'minor': - VERSION_MINOR += 1 - VERSION_BUILD = 0 - VERSION_ALPHA = 1 - elif part == 'build': - VERSION_BUILD += 1 - VERSION_ALPHA = 1 - elif part == 'alpha': - VERSION_ALPHA += 1 - - with open(version_file, 'w') as file: - file.write(f"""# START_VERSION_BLOCK -VERSION_MAJOR = {VERSION_MAJOR} -VERSION_MINOR = {VERSION_MINOR} -VERSION_BUILD = {VERSION_BUILD} -VERSION_ALPHA = {VERSION_ALPHA} -# END_VERSION_BLOCK""") - - -if __name__ == "__main__": - parser = argparse.ArgumentParser(description='Update the version based on the specified part (major, minor, build, alpha)') - parser.add_argument('part', help='Part of the version to update (major, minor, build, alpha)') - parser.add_argument('--version-file', help='Path to the version.py file', required=True) - - args = parser.parse_args() - - update_version(args.part, abspath(args.version_file)) diff --git a/version.py b/version.py index bbc2a72..e0c04e7 100644 --- a/version.py +++ b/version.py @@ -2,5 +2,5 @@ VERSION_MAJOR = 0 VERSION_MINOR = 1 VERSION_BUILD = 1 -VERSION_ALPHA = 0 -# END_VERSION_BLOCK +VERSION_ALPHA = 1 +# END_VERSION_BLOCK \ No newline at end of file