From 6a52b1d44fe6c1cb5a69d99766fb0bfd9265a2a4 Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 30 Apr 2024 00:25:31 +0700 Subject: [PATCH] (bump:patch) trigger bump and release --- .github/workflows/auto-bump-and-release.yaml | 46 ++++++++++++++++++++ .github/workflows/style-check.yaml | 2 +- .github/workflows/unit-test.yaml | 13 ++---- 3 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/auto-bump-and-release.yaml diff --git a/.github/workflows/auto-bump-and-release.yaml b/.github/workflows/auto-bump-and-release.yaml new file mode 100644 index 000000000..fb0a71cc4 --- /dev/null +++ b/.github/workflows/auto-bump-and-release.yaml @@ -0,0 +1,46 @@ +name: Auto Bump and Release + +on: push + +jobs: + auto-bump-and-release: + runs-on: ubuntu-latest + steps: + - name: Clone the repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Update Application Version + id: update-version + uses: anothrNick/github-tag-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WITH_V: true + DEFAULT_BUMP: none + MAJOR_STRING_TOKEN: "bump:major" + MINOR_STRING_TOKEN: "bump:minor" + PATCH_STRING_TOKEN: "bump:patch" + - name: Create release for ${{ steps.update-version.outputs.new_tag }} + run: | + echo Create release folder + mkdir kotaemon-app + echo ${{steps.update-version.outputs.new_tag }} > kotaemon-app/VERSION + cp LICENSE.txt kotaemon-app/ + cp flowsettings.py kotaemon-app/ + cp app.py kotaemon-app/ + cp -r scripts kotaemon-app/ + tree kotaemon-app + zip -r kotaemon-app.zip kotaemon-app + - name: Release ${{ steps.update-version.outputs.new_tag }} + uses: softprops/action-gh-release@v2 + with: + files: kotaemon-app.zip + fail_on_unmatched_files: true + token: ${{ secrets.GITHUB_TOKEN }} + generate_release_notes: true + tag_name: ${{ steps.update-version.outputs.new_tag }} + make_latest: true + - name: Update latest tag + uses: EndBug/latest-tag@latest + with: + ref: latest diff --git a/.github/workflows/style-check.yaml b/.github/workflows/style-check.yaml index 204746162..1e17041d9 100644 --- a/.github/workflows/style-check.yaml +++ b/.github/workflows/style-check.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/unit-test.yaml b/.github/workflows/unit-test.yaml index f49a79a03..315acd842 100644 --- a/.github/workflows/unit-test.yaml +++ b/.github/workflows/unit-test.yaml @@ -33,7 +33,7 @@ jobs: name: unit testing with python ${{ matrix.python-version }} steps: - name: Clone the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} @@ -56,11 +56,9 @@ jobs: - name: Get cache key id: get-cache-key - # using tomli so that it works on windows. From python 3.11, this can be switched to the - # built-in tomllib run: | - pip install tomli - package_version=$(python -c "import tomli; print(tomli.load(open('libs/kotaemon/pyproject.toml', 'rb'))['project']['version'])") + pip install "setuptools-git-versioning>=2.0,<3" + package_version=$(setuptools-git-versioning) cache_key="${{ runner.os }}-py${{ matrix.python-version }}-v${package_version}" echo "key=$cache_key" | tee -a ${{ matrix.GITHUB_OUTPUT }} @@ -82,10 +80,7 @@ jobs: cache_hit=${{ steps.restore-dependencies.outputs.cache-primary-key == steps.restore-dependencies.outputs.cache-matched-key }} echo "check=$cache_hit" | tee -a ${{ matrix.GITHUB_OUTPUT }} - - name: Install dependencies if ignore caching or no cache hit - if: | - steps.check-ignore-cache.outputs.check == 'true' || - steps.check-cache-hit.outputs.check != 'true' + - name: Install additional dependencies (if any) run: | python -m pip install --upgrade pip cd libs/kotaemon