Skip to content

Bump version

Bump version #30

Workflow file for this run

name: Bump version
on:
schedule:
- cron: "00 23 * * *"
workflow_dispatch:
jobs:
check_commits:
name: Check for new commits
runs-on: ubuntu-latest
outputs:
new_commits: ${{ steps.check_new_commits.outputs.new_commits }}
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: custom_components/solarman/
sparse-checkout-cone-mode: false
- name: Check for new commits
id: check_new_commits
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
runs-on: ubuntu-latest
needs: check_commits
if: needs.check_commits.outputs.new_commits == 'true' || github.event_name == 'workflow_dispatch'
permissions: write-all
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: custom_components/solarman/manifest.json
sparse-checkout-cone-mode: false
- run: |
version=$(date +"%y.%m.%d")
sed -i "s/.*version.*/ \"version\": \"$version\"/" custom_components/solarman/manifest.json
git config --global user.name "Continuous Integration"
git config --global user.email "[email protected]"
git commit -m "chore: Bump version" custom_components/solarman/manifest.json
git tag -a "v$version" -m "Scheduled $([[ $version == *4 ]] || echo 'pre-')release"
git push --follow-tags