From 63b6ea5859d78307c6b0b8290d6c78d2f54b425a Mon Sep 17 00:00:00 2001 From: Jaekwon Bang Date: Mon, 26 Jul 2021 18:15:10 +0900 Subject: [PATCH 1/4] Update version in setup.py when released --- .bumpversion.cfg | 7 +++++++ .github/workflows/publish-release.yml | 26 +++++++++++++++++++++++++- .reuse/dep5 | 6 +++++- LICENSES/MIT.txt | 21 +++++++++++++++++++++ requirements.txt | 1 + 5 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 .bumpversion.cfg create mode 100644 LICENSES/MIT.txt diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..d8ce013 --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,7 @@ +[bumpversion] +commit = False +tag = False + +[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 2bb8280..72d4a78 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -12,6 +12,30 @@ 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_TAGS=$(git for-each-ref refs/tags/ --count=2 --sort=-v:refname --format="%(refname:short)") + LAST_ONE=$(echo $LAST_TAGS | cut -d' ' -f 2) + last_version=$(echo ${LAST_ONE//v/""}) + echo ${last_version} + new_version=$(echo ${NEW_TAG//v/""}) + echo ${new_version} + bumpversion --current-version $last_version --new-version $new_version setup.py + git config --local user.name "github-actions[bot]" + git add setup.py + git commit -m "Update Version in setup.py" - name: update changelog with gren env: GREN_GITHUB_TOKEN: ${{ secrets.TOKEN }} @@ -28,7 +52,7 @@ jobs: with: github_token: ${{ secrets.TOKEN }} branch: main - + deploy: runs-on: ubuntu-18.04 needs: update-changelog diff --git a/.reuse/dep5 b/.reuse/dep5 index 7d3fcdf..4147fc3 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -16,4 +16,8 @@ License: Apache-2.0 Files: requirements*.txt Copyright: 2021 LG Electronics -License: Apache-2.0 \ No newline at end of file +License: Apache-2.0 + +Files: .bumpversion.cfg +Copyright: 2013-2014 Filip Noetzel +License: MIT diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt new file mode 100644 index 0000000..7029925 --- /dev/null +++ b/LICENSES/MIT.txt @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/requirements.txt b/requirements.txt index abbd040..5c0ed70 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ progress PyYAML lastversion coloredlogs +bumpversion From a4c5c57fa544ceb81f9b8efc43ce883f72ecae0e Mon Sep 17 00:00:00 2001 From: Jaekwon Bang Date: Tue, 27 Jul 2021 08:37:25 +0900 Subject: [PATCH 2/4] Modify bumpverion configure --- .bumpversion.cfg | 3 ++- .github/workflows/publish-release.yml | 12 +++++------- .reuse/dep5 | 4 ++-- LICENSES/MIT.txt | 21 --------------------- 4 files changed, 9 insertions(+), 31 deletions(-) delete mode 100644 LICENSES/MIT.txt diff --git a/.bumpversion.cfg b/.bumpversion.cfg index d8ce013..e5886fc 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,6 +1,7 @@ [bumpversion] -commit = False +commit = True tag = False +message = Bump version: {current_version} → {new_version} [bumpversion:file:setup.py] search='{current_version}' diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 72d4a78..382a761 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -26,16 +26,14 @@ jobs: NEW_TAG: ${{ steps.get_release.outputs.tag_name }} run: | pip install --upgrade bumpversion - LAST_TAGS=$(git for-each-ref refs/tags/ --count=2 --sort=-v:refname --format="%(refname:short)") - LAST_ONE=$(echo $LAST_TAGS | cut -d' ' -f 2) + 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} + echo Last version: ${last_version} new_version=$(echo ${NEW_TAG//v/""}) - echo ${new_version} - bumpversion --current-version $last_version --new-version $new_version setup.py + echo New version: ${new_version} git config --local user.name "github-actions[bot]" - git add setup.py - git commit -m "Update Version in setup.py" + 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 4147fc3..06d2f8e 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -19,5 +19,5 @@ Copyright: 2021 LG Electronics License: Apache-2.0 Files: .bumpversion.cfg -Copyright: 2013-2014 Filip Noetzel -License: MIT +Copyright: 2021 LG Electronics +License: Apache-2.0 diff --git a/LICENSES/MIT.txt b/LICENSES/MIT.txt deleted file mode 100644 index 7029925..0000000 --- a/LICENSES/MIT.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. From 9fe8928b331b672f3aee88b96a942b21e1ddf999 Mon Sep 17 00:00:00 2001 From: Jaekwon Bang Date: Tue, 27 Jul 2021 08:47:23 +0900 Subject: [PATCH 3/4] Delete unused package - Bumpversion --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5c0ed70..abbd040 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,4 +6,3 @@ progress PyYAML lastversion coloredlogs -bumpversion From 3d71ccddcf02de6f413e81727cf5800c4e40f4b0 Mon Sep 17 00:00:00 2001 From: Jaekwon Bang Date: Tue, 27 Jul 2021 19:29:13 +0900 Subject: [PATCH 4/4] Remove waring in publish-release.yml --- .github/workflows/publish-release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 382a761..9b88822 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -19,8 +19,6 @@ jobs: 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 }}