From 92a5c09f9bed67f015159f1afe26f8042f7a786d Mon Sep 17 00:00:00 2001 From: Paul Adkisson Date: Thu, 7 Nov 2024 05:28:13 +1100 Subject: [PATCH 1/9] sort tags --- .github/workflows/update-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index 4419abf9..7c456c57 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -17,7 +17,7 @@ jobs: - name: Update dev version run: | git fetch --prune --unshallow --tags - tags="$(git tag --list)" + tags="$(git tag --sort version:refname)" latest_tag=${tags: -6 : 6} old_version=${latest_tag:1:5} echo "Old Version: $old_version" From 151a06c17548d9633f9ca2de412c523ba3b4b344 Mon Sep 17 00:00:00 2001 From: Paul Adkisson Date: Thu, 7 Nov 2024 06:22:31 +1100 Subject: [PATCH 2/9] Update update-version.yml to support multi-digit versions --- .github/workflows/update-version.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index 7c456c57..c5b9ab58 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -17,13 +17,14 @@ jobs: - name: Update dev version run: | git fetch --prune --unshallow --tags - tags="$(git tag --sort version:refname)" - latest_tag=${tags: -6 : 6} - old_version=${latest_tag:1:5} + tags=("${(@f)$(git tag --list --sort version:refname)}") + latest_tag=${tags[-1]} + old_version="${latest_tag:1}" echo "Old Version: $old_version" - old_major_version=${old_version:0:1} - old_minor_version=${old_version:2:1} - old_patch_version=${old_version:4:1} + split_old_version=("${(@s:.:)old_version}") + old_major_version=${split_old_version[0]} + old_minor_version=${split_old_version[1]} + old_patch_version=${split_old_version[2]} new_patch_version=`expr $old_patch_version + 1` new_version="$old_major_version.$old_minor_version.$new_patch_version" echo "New Version: $new_version" From bd09e7caa6b10120220301f224fa101ca9758074 Mon Sep 17 00:00:00 2001 From: Paul Adkisson Date: Thu, 7 Nov 2024 07:44:59 +1100 Subject: [PATCH 3/9] use bash-compatible commands (instead of zsh) --- .github/workflows/update-version.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index c5b9ab58..f484075e 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -17,11 +17,11 @@ jobs: - name: Update dev version run: | git fetch --prune --unshallow --tags - tags=("${(@f)$(git tag --list --sort version:refname)}") - latest_tag=${tags[-1]} + IFS=$'\n' read -rd '' -a tags <<<"$(git tag --list --sort version:refname)" + latest_tag=${y[${#y[@]} - 1]} old_version="${latest_tag:1}" echo "Old Version: $old_version" - split_old_version=("${(@s:.:)old_version}") + IFS=$'.' read -rd '' -a split_old_version <<<"$old_version" old_major_version=${split_old_version[0]} old_minor_version=${split_old_version[1]} old_patch_version=${split_old_version[2]} From 0c03f5afb4883602fa1ecf7143870052b33389ae Mon Sep 17 00:00:00 2001 From: Paul Adkisson Date: Thu, 7 Nov 2024 08:35:30 +1100 Subject: [PATCH 4/9] debug --- .github/workflows/update-version.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index f484075e..5d80fb80 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -18,19 +18,20 @@ jobs: run: | git fetch --prune --unshallow --tags IFS=$'\n' read -rd '' -a tags <<<"$(git tag --list --sort version:refname)" - latest_tag=${y[${#y[@]} - 1]} - old_version="${latest_tag:1}" - echo "Old Version: $old_version" - IFS=$'.' read -rd '' -a split_old_version <<<"$old_version" - old_major_version=${split_old_version[0]} - old_minor_version=${split_old_version[1]} - old_patch_version=${split_old_version[2]} - new_patch_version=`expr $old_patch_version + 1` - new_version="$old_major_version.$old_minor_version.$new_patch_version" - echo "New Version: $new_version" - sed -i -e "s/version=\"$old_version\"/version=\"$new_version\"/g" setup.py - echo "old_version=$old_version" >> "$GITHUB_ENV" - echo "new_version=$new_version" >> "$GITHUB_ENV" + echo $tags + # latest_tag=${y[${#y[@]} - 1]} + # old_version="${latest_tag:1}" + # echo "Old Version: $old_version" + # IFS=$'.' read -rd '' -a split_old_version <<<"$old_version" + # old_major_version=${split_old_version[0]} + # old_minor_version=${split_old_version[1]} + # old_patch_version=${split_old_version[2]} + # new_patch_version=`expr $old_patch_version + 1` + # new_version="$old_major_version.$old_minor_version.$new_patch_version" + # echo "New Version: $new_version" + # sed -i -e "s/version=\"$old_version\"/version=\"$new_version\"/g" setup.py + # echo "old_version=$old_version" >> "$GITHUB_ENV" + # echo "new_version=$new_version" >> "$GITHUB_ENV" - name: Commit Changes and Create Pull Request run: | git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com From 37116832205d4957fa678942ae6af31c085d942d Mon Sep 17 00:00:00 2001 From: Paul Adkisson Date: Thu, 7 Nov 2024 08:37:28 +1100 Subject: [PATCH 5/9] debug --- .github/workflows/update-version.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index 5d80fb80..ffc93e39 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -17,8 +17,8 @@ jobs: - name: Update dev version run: | git fetch --prune --unshallow --tags - IFS=$'\n' read -rd '' -a tags <<<"$(git tag --list --sort version:refname)" - echo $tags + # IFS=$'\n' read -rd '' -a tags <<<"$(git tag --list --sort version:refname)" + # echo $tags # latest_tag=${y[${#y[@]} - 1]} # old_version="${latest_tag:1}" # echo "Old Version: $old_version" From 22056c558193146777cabbb5ba18b70b615456ce Mon Sep 17 00:00:00 2001 From: Paul Adkisson Date: Thu, 7 Nov 2024 08:40:00 +1100 Subject: [PATCH 6/9] debug --- .github/workflows/update-version.yml | 31 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index ffc93e39..ba36fb2f 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -17,21 +17,22 @@ jobs: - name: Update dev version run: | git fetch --prune --unshallow --tags - # IFS=$'\n' read -rd '' -a tags <<<"$(git tag --list --sort version:refname)" - # echo $tags - # latest_tag=${y[${#y[@]} - 1]} - # old_version="${latest_tag:1}" - # echo "Old Version: $old_version" - # IFS=$'.' read -rd '' -a split_old_version <<<"$old_version" - # old_major_version=${split_old_version[0]} - # old_minor_version=${split_old_version[1]} - # old_patch_version=${split_old_version[2]} - # new_patch_version=`expr $old_patch_version + 1` - # new_version="$old_major_version.$old_minor_version.$new_patch_version" - # echo "New Version: $new_version" - # sed -i -e "s/version=\"$old_version\"/version=\"$new_version\"/g" setup.py - # echo "old_version=$old_version" >> "$GITHUB_ENV" - # echo "new_version=$new_version" >> "$GITHUB_ENV" + IFS=$'\n' read -rd '' -a tags <<<"$(git tag --list --sort version:refname)" + echo $tags + latest_tag=${y[${#y[@]} - 1]} + old_version="${latest_tag:1}" + echo "Old Version: $old_version" + IFS=$'.' read -rd '' -a split_old_version <<<"$old_version" + old_major_version=${split_old_version[0]} + old_minor_version=${split_old_version[1]} + old_patch_version=${split_old_version[2]} + new_patch_version=`expr $old_patch_version + 1` + new_version="$old_major_version.$old_minor_version.$new_patch_version" + echo "New Version: $new_version" + sed -i -e "s/version=\"$old_version\"/version=\"$new_version\"/g" setup.py + echo "old_version=$old_version" >> "$GITHUB_ENV" + echo "new_version=$new_version" >> "$GITHUB_ENV" + shell: bash - name: Commit Changes and Create Pull Request run: | git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com From d95cf63eb9b4dd5b73f6a4b201648b0d68b3a34e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 21:40:08 +0000 Subject: [PATCH 7/9] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/update-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index ba36fb2f..9615060e 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -32,7 +32,7 @@ jobs: sed -i -e "s/version=\"$old_version\"/version=\"$new_version\"/g" setup.py echo "old_version=$old_version" >> "$GITHUB_ENV" echo "new_version=$new_version" >> "$GITHUB_ENV" - shell: bash + shell: bash - name: Commit Changes and Create Pull Request run: | git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com From 4d1f47b42286341d10c2c622a99f5b6a1cca18e7 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Mon, 11 Nov 2024 13:07:10 -0800 Subject: [PATCH 8/9] debug --- .github/workflows/update-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index 9615060e..5b005ce8 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -19,7 +19,7 @@ jobs: git fetch --prune --unshallow --tags IFS=$'\n' read -rd '' -a tags <<<"$(git tag --list --sort version:refname)" echo $tags - latest_tag=${y[${#y[@]} - 1]} + # latest_tag=${y[${#y[@]} - 1]} old_version="${latest_tag:1}" echo "Old Version: $old_version" IFS=$'.' read -rd '' -a split_old_version <<<"$old_version" From 85ed513eaa2981f791c731452329d477c802d723 Mon Sep 17 00:00:00 2001 From: pauladkisson Date: Wed, 13 Nov 2024 10:05:54 -0800 Subject: [PATCH 9/9] removed update dev version on release --- .github/workflows/update-version.yml | 44 ---------------------------- 1 file changed, 44 deletions(-) delete mode 100644 .github/workflows/update-version.yml diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml deleted file mode 100644 index 5b005ce8..00000000 --- a/.github/workflows/update-version.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Update Dev Version on Release - -on: - workflow_dispatch: - workflow_run: - workflows: [Upload Package to PyPI] - types: [completed] - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Checkout New Branch - run: | - git checkout -b update_dev_version - - name: Update dev version - run: | - git fetch --prune --unshallow --tags - IFS=$'\n' read -rd '' -a tags <<<"$(git tag --list --sort version:refname)" - echo $tags - # latest_tag=${y[${#y[@]} - 1]} - old_version="${latest_tag:1}" - echo "Old Version: $old_version" - IFS=$'.' read -rd '' -a split_old_version <<<"$old_version" - old_major_version=${split_old_version[0]} - old_minor_version=${split_old_version[1]} - old_patch_version=${split_old_version[2]} - new_patch_version=`expr $old_patch_version + 1` - new_version="$old_major_version.$old_minor_version.$new_patch_version" - echo "New Version: $new_version" - sed -i -e "s/version=\"$old_version\"/version=\"$new_version\"/g" setup.py - echo "old_version=$old_version" >> "$GITHUB_ENV" - echo "new_version=$new_version" >> "$GITHUB_ENV" - shell: bash - - name: Commit Changes and Create Pull Request - run: | - git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com - git config --global user.name github-actions[bot] - git commit . -m "Update dev version from $old_version to $new_version" - git push origin update_dev_version - gh pr create --title "[Github.CI] Update dev version from $old_version to $new_version" --body "version: $old_version --> $new_version" - env: - GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}