From 489d5a43c1922745f51154cd197d8e09b040160d Mon Sep 17 00:00:00 2001 From: Kay Jan Date: Mon, 16 Oct 2023 23:14:27 +0800 Subject: [PATCH 01/12] Added: Automatic release notes generation --- .github/workflows/python-publish.yml | 47 ++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index ead5afd2..741c5af7 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -28,3 +28,50 @@ jobs: HATCH_USER: ${{ secrets.HATCH_USER }} HATCH_AUTH: ${{ secrets.HATCH_AUTH }} run: hatch publish -u $HATCH_USER -a $HATCH_AUTH + - name: Set env var + id: set-variable + run: | + VERSION_NUMBER=$(python -c "import bigtree; print(bigtree.__version__)") + echo "VERSION_NUMBER=${VERSION_NUMBER}" >> $GITHUB_OUTPUT + - name: Use your variable + run: | + echo "Your variable value is ${{ steps.set-variable.outputs.YOUR_VARIABLE }}" + - name: Relese notes format + uses: Beakyn/gha-format-release-notes@v1 + id: format + env: + GITHUB_TOKEN: ${{ github.token }} + with: + # required + repository: ${{ github.repository }} + milestone: ${{ github.event.inputs.milestone }} + + # optional + custom-row: "${issue.number} <--> ${issue.title}" + custom-group-by-label: | + [ + { + "title": "### Feature 🎉", + "labels": ["added"] + }, + { + "title": "### Bug Fixes 🐛", + "labels": ["fix"] + }, + { + "title": "### Refactor & Improvements ✨", + "labels": ["changed"] + } + ] + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + VERSION_NUMBER: ${{ steps.set-variable.outputs.VERSION_NUMBER }} + with: + tag_name: ${{ VERSION_NUMBER }} + release_name: v${{ VERSION_NUMBER }} + body: ${{steps.format.outputs.release-notes}} + draft: false + prerelease: false From 2a677a8715701ef1322409689b25caa9b9d30915 Mon Sep 17 00:00:00 2001 From: Kay Jan Date: Mon, 16 Oct 2023 23:16:24 +0800 Subject: [PATCH 02/12] Changed: Trigger workflow on PR --- .github/workflows/python-publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 741c5af7..d8d236b4 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -4,6 +4,8 @@ on: push: branches: - master + pull_request: + types: [opened, synchronize] permissions: contents: read From 70bbcdb2f286805bd009f7cb8f4794cb067b6f77 Mon Sep 17 00:00:00 2001 From: Kay Jan Date: Mon, 16 Oct 2023 23:18:47 +0800 Subject: [PATCH 03/12] Fixed: Referencing env var in github workflow --- .github/workflows/python-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index d8d236b4..d3040b94 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -72,8 +72,8 @@ jobs: GITHUB_TOKEN: ${{ github.token }} VERSION_NUMBER: ${{ steps.set-variable.outputs.VERSION_NUMBER }} with: - tag_name: ${{ VERSION_NUMBER }} - release_name: v${{ VERSION_NUMBER }} + tag_name: ${{ env.VERSION_NUMBER }} + release_name: v${{ env.VERSION_NUMBER }} body: ${{steps.format.outputs.release-notes}} draft: false prerelease: false From 3c316b103ce5ccb69b7bed03a233f56a1b742886 Mon Sep 17 00:00:00 2001 From: Kay Jan Date: Mon, 16 Oct 2023 23:22:41 +0800 Subject: [PATCH 04/12] Fixed: Filling in milestone for gha --- .github/workflows/python-publish.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index d3040b94..f2d578f4 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -31,22 +31,23 @@ jobs: HATCH_AUTH: ${{ secrets.HATCH_AUTH }} run: hatch publish -u $HATCH_USER -a $HATCH_AUTH - name: Set env var - id: set-variable + id: set-env-var run: | VERSION_NUMBER=$(python -c "import bigtree; print(bigtree.__version__)") echo "VERSION_NUMBER=${VERSION_NUMBER}" >> $GITHUB_OUTPUT - name: Use your variable run: | - echo "Your variable value is ${{ steps.set-variable.outputs.YOUR_VARIABLE }}" + echo "Your variable value is ${{ steps.set-env-var.outputs.VERSION_NUMBER }}" - name: Relese notes format + id: release-format uses: Beakyn/gha-format-release-notes@v1 - id: format env: GITHUB_TOKEN: ${{ github.token }} + VERSION_NUMBER: ${{ steps.set-env-var.outputs.VERSION_NUMBER }} with: # required repository: ${{ github.repository }} - milestone: ${{ github.event.inputs.milestone }} + milestone: ${{ env.VERSION_NUMBER }} # optional custom-row: "${issue.number} <--> ${issue.title}" @@ -70,10 +71,10 @@ jobs: uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ github.token }} - VERSION_NUMBER: ${{ steps.set-variable.outputs.VERSION_NUMBER }} + VERSION_NUMBER: ${{ steps.set-env-var.outputs.VERSION_NUMBER }} with: tag_name: ${{ env.VERSION_NUMBER }} release_name: v${{ env.VERSION_NUMBER }} - body: ${{steps.format.outputs.release-notes}} + body: ${{steps.release-format.outputs.release-notes}} draft: false prerelease: false From 69335c7cb947d342ae717e8751239b75bfe56fda Mon Sep 17 00:00:00 2001 From: Kay Jan Date: Tue, 17 Oct 2023 01:47:37 +0800 Subject: [PATCH 05/12] Changed: Remove release notes format --- .github/workflows/python-publish.yml | 36 ++++------------------------ 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index f2d578f4..8c70ca1b 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -35,37 +35,6 @@ jobs: run: | VERSION_NUMBER=$(python -c "import bigtree; print(bigtree.__version__)") echo "VERSION_NUMBER=${VERSION_NUMBER}" >> $GITHUB_OUTPUT - - name: Use your variable - run: | - echo "Your variable value is ${{ steps.set-env-var.outputs.VERSION_NUMBER }}" - - name: Relese notes format - id: release-format - uses: Beakyn/gha-format-release-notes@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - VERSION_NUMBER: ${{ steps.set-env-var.outputs.VERSION_NUMBER }} - with: - # required - repository: ${{ github.repository }} - milestone: ${{ env.VERSION_NUMBER }} - - # optional - custom-row: "${issue.number} <--> ${issue.title}" - custom-group-by-label: | - [ - { - "title": "### Feature 🎉", - "labels": ["added"] - }, - { - "title": "### Bug Fixes 🐛", - "labels": ["fix"] - }, - { - "title": "### Refactor & Improvements ✨", - "labels": ["changed"] - } - ] - name: Create release id: create_release uses: actions/create-release@v1 @@ -75,6 +44,9 @@ jobs: with: tag_name: ${{ env.VERSION_NUMBER }} release_name: v${{ env.VERSION_NUMBER }} - body: ${{steps.release-format.outputs.release-notes}} + body: | + Changes in this Release + - First Change + - Second Change draft: false prerelease: false From 396657e8fa24a05597e857d0d0b43632193ed765 Mon Sep 17 00:00:00 2001 From: Kay Date: Tue, 17 Oct 2023 02:07:08 +0800 Subject: [PATCH 06/12] v0.13.2 increment version --- CHANGELOG.md | 5 +++++ bigtree/__init__.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6283e96a..3667c5da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.13.2] - 2023-10-17 +### Added +- Misc: Add automatic release notes into GitHub workflow. + ## [0.13.1] - 2023-10-15 ### Added - Misc: Add automatic comment on code coverage to pull requests into GitHub workflow. @@ -346,6 +350,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Utility Iterator: Tree traversal methods. - Workflow To Do App: Tree use case with to-do list implementation. +[0.13.2]: https://github.com/kayjan/bigtree/compare/0.13.1...0.13.2 [0.13.1]: https://github.com/kayjan/bigtree/compare/0.13.0...0.13.1 [0.13.0]: https://github.com/kayjan/bigtree/compare/0.12.5...0.13.0 [0.12.5]: https://github.com/kayjan/bigtree/compare/0.12.4...0.12.5 diff --git a/bigtree/__init__.py b/bigtree/__init__.py index b3d87d37..175f24cc 100644 --- a/bigtree/__init__.py +++ b/bigtree/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.13.1" +__version__ = "0.13.2" from bigtree.binarytree.construct import list_to_binarytree from bigtree.dag.construct import dataframe_to_dag, dict_to_dag, list_to_dag From 49c57f79a236a7cc3b38a1f3ab4f9dbf52a44c6e Mon Sep 17 00:00:00 2001 From: Kay Jan Date: Tue, 17 Oct 2023 02:13:09 +0800 Subject: [PATCH 07/12] Added: Format for release notes --- .github/workflows/python-publish.yml | 35 ++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 8c70ca1b..c27ec6fe 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -35,18 +35,43 @@ jobs: run: | VERSION_NUMBER=$(python -c "import bigtree; print(bigtree.__version__)") echo "VERSION_NUMBER=${VERSION_NUMBER}" >> $GITHUB_OUTPUT + - name: Release notes format + id: release-format + uses: Beakyn/gha-format-release-notes@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION_NUMBER: ${{ steps.set-env-var.outputs.VERSION_NUMBER }} + with: + # required + repository: ${{ github.repository }} + milestone: ${{ env.VERSION_NUMBER }} + + # optional + custom-row: "${issue.number} <--> ${issue.title}" + custom-group-by-label: | + [ + { + "title": "### Feature 🎉", + "labels": ["added"] + }, + { + "title": "### Bug Fixes 🐛", + "labels": ["fixed"] + }, + { + "title": "### Refactor & Improvements ✨", + "labels": ["changed"] + } + ] - name: Create release id: create_release uses: actions/create-release@v1 env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VERSION_NUMBER: ${{ steps.set-env-var.outputs.VERSION_NUMBER }} with: tag_name: ${{ env.VERSION_NUMBER }} release_name: v${{ env.VERSION_NUMBER }} - body: | - Changes in this Release - - First Change - - Second Change + body: ${{steps.release-format.outputs.release-notes}} draft: false prerelease: false From a03d0a0c4149a78180fdedb435d328d01fb5a244 Mon Sep 17 00:00:00 2001 From: Kay Jan Date: Tue, 17 Oct 2023 02:20:18 +0800 Subject: [PATCH 08/12] Changed: Permissions for gha --- .github/workflows/python-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index c27ec6fe..6f17f7fa 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -8,7 +8,7 @@ on: types: [opened, synchronize] permissions: - contents: read + contents: write jobs: deploy: From 789b6e9face0a005ac6e1af2075389f49fd27e34 Mon Sep 17 00:00:00 2001 From: Kay Jan Date: Tue, 17 Oct 2023 02:22:32 +0800 Subject: [PATCH 09/12] Changed: Remove release notes format due to validation error --- .github/workflows/python-publish.yml | 33 ++++------------------------ 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 6f17f7fa..f2ea5a1c 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -35,34 +35,6 @@ jobs: run: | VERSION_NUMBER=$(python -c "import bigtree; print(bigtree.__version__)") echo "VERSION_NUMBER=${VERSION_NUMBER}" >> $GITHUB_OUTPUT - - name: Release notes format - id: release-format - uses: Beakyn/gha-format-release-notes@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - VERSION_NUMBER: ${{ steps.set-env-var.outputs.VERSION_NUMBER }} - with: - # required - repository: ${{ github.repository }} - milestone: ${{ env.VERSION_NUMBER }} - - # optional - custom-row: "${issue.number} <--> ${issue.title}" - custom-group-by-label: | - [ - { - "title": "### Feature 🎉", - "labels": ["added"] - }, - { - "title": "### Bug Fixes 🐛", - "labels": ["fixed"] - }, - { - "title": "### Refactor & Improvements ✨", - "labels": ["changed"] - } - ] - name: Create release id: create_release uses: actions/create-release@v1 @@ -72,6 +44,9 @@ jobs: with: tag_name: ${{ env.VERSION_NUMBER }} release_name: v${{ env.VERSION_NUMBER }} - body: ${{steps.release-format.outputs.release-notes}} + body: | + Changes in this Release + - First Change + - Second Change draft: false prerelease: false From 3f4e8d6bf01a125e5b91b905709fc0b6567980d1 Mon Sep 17 00:00:00 2001 From: Kay Jan Date: Tue, 17 Oct 2023 02:30:02 +0800 Subject: [PATCH 10/12] Changed: Changed gha --- .github/workflows/python-publish.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index f2ea5a1c..96609d98 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -36,17 +36,14 @@ jobs: VERSION_NUMBER=$(python -c "import bigtree; print(bigtree.__version__)") echo "VERSION_NUMBER=${VERSION_NUMBER}" >> $GITHUB_OUTPUT - name: Create release - id: create_release - uses: actions/create-release@v1 + uses: marvinpinto/action-automatic-releases@latest env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VERSION_NUMBER: ${{ steps.set-env-var.outputs.VERSION_NUMBER }} with: - tag_name: ${{ env.VERSION_NUMBER }} - release_name: v${{ env.VERSION_NUMBER }} - body: | - Changes in this Release - - First Change - - Second Change - draft: false - prerelease: false + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: ${{ env.VERSION_NUMBER }} + title: v${{ env.VERSION_NUMBER }} + prerelease: true + files: | + *.zip + *.tar.gz From 523bd550333363dd8cc718920aff7ee31a7ab55d Mon Sep 17 00:00:00 2001 From: Kay Jan Date: Tue, 17 Oct 2023 02:45:35 +0800 Subject: [PATCH 11/12] Changed: Change gha --- .github/workflows/python-publish.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 96609d98..061aa214 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -36,14 +36,11 @@ jobs: VERSION_NUMBER=$(python -c "import bigtree; print(bigtree.__version__)") echo "VERSION_NUMBER=${VERSION_NUMBER}" >> $GITHUB_OUTPUT - name: Create release - uses: marvinpinto/action-automatic-releases@latest + uses: ncipollo/release-action@v1 env: VERSION_NUMBER: ${{ steps.set-env-var.outputs.VERSION_NUMBER }} with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - automatic_release_tag: ${{ env.VERSION_NUMBER }} - title: v${{ env.VERSION_NUMBER }} - prerelease: true - files: | - *.zip - *.tar.gz + name: v${{ env.VERSION_NUMBER }} + tag: ${{ env.VERSION_NUMBER }} + artifacts: "*.zip,*.tar.gz" + makeLatest: true From 67e90c4e3377903c575ff479e83eb604a16b8292 Mon Sep 17 00:00:00 2001 From: Kay Jan Date: Tue, 17 Oct 2023 02:48:00 +0800 Subject: [PATCH 12/12] Update: Only trigger release on push to master --- .github/workflows/python-publish.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 061aa214..b69f5c97 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -4,8 +4,6 @@ on: push: branches: - master - pull_request: - types: [opened, synchronize] permissions: contents: write