Skip to content

Commit

Permalink
feat: Improved Bump version workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
davidrapan committed Aug 14, 2024
1 parent a5cb866 commit 5776adb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,27 @@ jobs:
run: |
git_log=$(git log --since=midnight -- custom_components/solarman/)
echo "new_commits=$([[ -n "$git_log" ]] && echo "true" || echo "false")" >> $GITHUB_OUTPUT
bump:
name: Bump
check_version:
name: Check for old version
runs-on: ubuntu-latest
needs: check_commits
if: needs.check_commits.outputs.new_commits == 'true' || github.event_name == 'workflow_dispatch'
outputs:
old_version: ${{ steps.check_old_version.outputs.old_version }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: custom_components/solarman/manifest.json
sparse-checkout-cone-mode: false
- name: Check for version
id: check_old_version
run: |
echo "old_version=$(grep -q "\"version\": \"$(date +"%y.%m.%d")\"" custom_components/solarman/manifest.json && echo "false" || echo "true")" >> $GITHUB_OUTPUT
bump:
name: Bump
runs-on: ubuntu-latest
needs: check_version
if: needs.check_version.outputs.old_version == 'true' || github.event_name == 'workflow_dispatch'
permissions: write-all
steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 3 additions & 2 deletions custom_components/solarman/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ def get_result(self, middleware = None):
self._is_reading = 0

result = middleware.get_result() if middleware else {}
result_count = len(result) if result else 0

if len(result) > 0:
_LOGGER.debug(f"Returning new values to the Coordinator. [Previous State: {self.get_connection_state()} ({self.state})]")
if result_count > 0:
_LOGGER.debug(f"Returning {result_count} new values to the Coordinator. [Previous State: {self.get_connection_state()} ({self.state})]")
now = datetime.now()
self.state_interval = now - self.state_updated
self.state_updated = now
Expand Down
1 change: 0 additions & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"name": "Solarman",
"render_readme": false,
"persistent_directory": "inverter_definitions/custom"
}

0 comments on commit 5776adb

Please sign in to comment.