Video editing with Python
Keep version string instead of tag, and play with workflow to first update string on tag, then trigger doc release
osaajani4bb847628d42
diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.ymlindex 4110bb50..b07a86ca 100644--- a/.github/workflows/build-docs.yml+++ b/.github/workflows/build-docs.yml@@ -3,10 +3,15 @@ name: Build and Deploy Sphinx Documentationon:push:branches:- - master # Change to your default branch if needed+ - "master" # Trigger on version tagsjobs:- build:+ build-docs:+ # This job builds the documentation and deploys it to GitHub Pages+ # it is automatically triggered by the update-version job via the commit+ # made in the update-version job that contains the commit message+ # '[bot] Update version to <version>'+ if: startsWith(github.event.head_commit.message, '[bot] Update version to')runs-on: ubuntu-lateststeps:@@ -21,7 +26,6 @@ jobs:- name: Build current documentationrun: |git fetch --tags- latest_tag=$(git tag --sort=-v:refname | head -n 1)echo "Latest tag: $latest_tag"git checkout "$latest_tag"pip install -e .@@ -29,9 +33,6 @@ jobs:cd docs- # Replace %VERSION% with the latest tag in conf.py- sed -i "s/%VERSION%/$latest_tag/g" conf.py-make htmlmkdir -p "../build/html/$latest_tag"cp -r build/html/* "../build/html/$latest_tag/"diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.ymlindex 1f485eca..c72302cb 100644--- a/.github/workflows/publish.yml+++ b/.github/workflows/publish.yml@@ -26,18 +26,6 @@ jobs:run: |pip install setuptools wheel build- - name: Set version from latest tag- run: |- git fetch --tags- latest_tag=$(git tag --sort=-v:refname | head -n 1)- echo "Latest tag: $latest_tag"-- # Update version in pyproject.toml- sed -i "s/%VERSION%/$latest_tag/g" pyproject.toml-- # Update version in moviepy/version.py- sed -i "s/%VERSION%/$latest_tag/g" moviepy/version.py-- name: Buildrun: |python -m builddiff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.ymlnew file mode 100644index 00000000..e1f9c645--- /dev/null+++ b/.github/workflows/update-version.yml@@ -0,0 +1,45 @@+name: Update Version on Tag++on:+ push:+ tags:+ - 'v*.*.*' # Trigger on version tags++jobs:+ update-version:+ runs-on: ubuntu-latest+ steps:+ - name: Checkout code+ uses: actions/checkout@v3+ with:+ fetch-depth: 0 # ensures tags are fetched++ - name: Extract version from tag+ id: get_version+ run: |+ TAG=${GITHUB_REF#refs/tags/}+ VERSION=${TAG#v}+ echo "version=$VERSION" >> $GITHUB_OUTPUT++ - name: Update version in pyproject.toml+ run: |+ sed -i "s/^version = \".*\"/version = \"${{ steps.get_version.outputs.version }}\"/" pyproject.toml++ - name: Update __version__ in source code+ run: |+ VERSION=${{ steps.get_version.outputs.version }}+ sed -i "s/^__version__ = \".*\"/__version__ = \"${VERSION}\"/" moviepy/version.py++ - name: Update version in docs/conf.py+ run: |+ VERSION=${{ steps.get_version.outputs.version }}+ sed -i "s/^version = \".*\"/version = \"${VERSION}\"/" docs/conf.py++ - name: Commit and push changes+ run: |+ git config user.name "github-actions[bot]"+ git config user.email "moviepy[bot]@users.noreply.github.com"+ git commit -am "[bot] Update version to ${{ steps.get_version.outputs.version }}"+ git push origin HEAD:${GITHUB_REF_NAME}+ env:+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}diff --git a/docs/conf.py b/docs/conf.pyindex b0d31a73..8fa512ba 100644--- a/docs/conf.py+++ b/docs/conf.py@@ -54,7 +54,8 @@ copyright = "2024, Zulko - MIT"# built documents.## The short X.Y version.-# version = '0.2'+version = "2.2.1"+# The full version, including alpha/beta/rc tags.# release = '0.2.3.1'@@ -120,10 +121,8 @@ html_theme_options = {"type": "fontawesome",}],- "announcement": f"""- <p>MoviePy v2.0 have introduced breaking changes,- see <a href="{v2_page}">Updating from v1.X to v2.X</a> for more info.</p>- """,+ "announcement": f"""<p>MoviePy v2.0 have introduced breaking changes,+ see <a href="{v2_page}">Updating from v1.X to v2.X</a> for more info.</p>""",}html_context = {diff --git a/moviepy/version.py b/moviepy/version.pyindex 5405e814..9a233370 100644--- a/moviepy/version.py+++ b/moviepy/version.py@@ -3,4 +3,4 @@ try:__version__ = version("moviepy")except Exception:- __version__ = "%VERSION%"+ __version__ = "2.1.2" # Fallback version if import failsdiff --git a/pyproject.toml b/pyproject.tomlindex 80c13b96..4330b306 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"[project]name = "moviepy"-version = "%VERSION%"+version = "2.1.2"description = "Video editing with Python"readme = "README.md"license = { text = "MIT License" }