From f95402670f681bc568c0294eee4911dd5f8ecb2a Mon Sep 17 00:00:00 2001 From: Jaekwon Bang Date: Tue, 27 Jul 2021 16:21:13 +0900 Subject: [PATCH] Update version in setup.py when released --- .bumpversion.cfg | 8 ++++++++ .github/workflows/publish-release.yml | 22 ++++++++++++++++++++++ .reuse/dep5 | 4 ++++ 3 files changed, 34 insertions(+) create mode 100644 .bumpversion.cfg diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..e5886fc --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,8 @@ +[bumpversion] +commit = True +tag = False +message = Bump version: {current_version} → {new_version} + +[bumpversion:file:setup.py] +search='{current_version}' +replace='{new_version}' diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index f5b1ece..beaf364 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -12,6 +12,28 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Get Release + uses: agners/get-draft-release@v1.2.2 + id: get_release + env: + GITHUB_TOKEN: ${{ github.token }} + with: + tag_name: ${{ github.ref }} + - name: Bump up version + env: + NEW_TAG: ${{ steps.get_release.outputs.tag_name }} + run: | + pip install --upgrade bumpversion + LAST_TWO_TAGS=$(git for-each-ref refs/tags/ --count=2 --sort=-v:refname --format="%(refname:short)") + LAST_ONE=$(echo $LAST_TWO_TAGS | cut -d' ' -f 2) + last_version=$(echo ${LAST_ONE//v/""}) + echo Last version: ${last_version} + new_version=$(echo ${NEW_TAG//v/""}) + echo New version: ${new_version} + git config --local user.name "github-actions[bot]" + bumpversion --current-version $last_version --new-version $new_version setup.py - name: update changelog with gren env: GREN_GITHUB_TOKEN: ${{ secrets.TOKEN }} diff --git a/.reuse/dep5 b/.reuse/dep5 index 9dae7f5..4359aa3 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -21,3 +21,7 @@ License: Apache-2.0 Files: requirements*.txt Copyright: 2021 LG Electronics License: Apache-2.0 + +Files: .bumpversion.cfg +Copyright: 2021 LG Electronics +License: Apache-2.0