-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get version from manifest.json | ||
id: get_version | ||
run: | | ||
version=$(jq -r .version custom_components/electric_kiwi/manifest.json) | ||
echo "::set-output name=version::$version" | ||
- name: Get previous version | ||
id: get_previous_version | ||
run: | | ||
previous_version=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | ||
echo "::set-output name=previous_version::$previous_version" | ||
- name: Generate changelog | ||
id: changelog | ||
run: | | ||
changelog=$(git log --pretty=format:"- %h - %an: %s" ${{ steps.get_previous_version.outputs.previous_version }}..HEAD) | ||
changelog="${changelog//'%'/'%25'}" | ||
changelog="${changelog//$'\n'/'%0A'}" | ||
changelog="${changelog//$'\r'/'%0D'}" | ||
echo "::set-output name=changelog::$changelog" | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ steps.get_version.outputs.version }} | ||
release_name: Release v${{ steps.get_version.outputs.version }} | ||
body: | | ||
# electric_kiwi - Home Assistant Integration v${{ steps.get_version.outputs.version }} 🚀 | ||
This release brings new features and improvements to the electric_kiwi integration for Home Assistant. 🌿🤖 | ||
## What's New 🎉 | ||
${{ steps.changelog.outputs.changelog }} | ||
## Installation 🛠️ | ||
1. Use HACS to install this custom repository. | ||
2. Restart Home Assistant. | ||
3. Add the electric_kiwi integration via the UI. | ||
For detailed instructions, please refer to the [README](https://github.com/${{ github.repository }}/blob/main/README.md). | ||
## Feedback and Support 💬 | ||
If you encounter any issues or have suggestions, please: | ||
- [Open an issue](https://github.com/${{ github.repository }}/issues) on GitHub | ||
- [Join our Discord](https://discord.gg/vpZdWhJX8x) for community support | ||
## Thank You 🙏 | ||
A big thank you to all contributors and users of this integration. Your feedback and support help make this project better! | ||
**Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ steps.get_previous_version.outputs.previous_version }}...v${{ steps.get_version.outputs.version }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Bump version | ||
run: | | ||
current_version=$(jq -r .version custom_components/electric_kiwi/manifest.json) | ||
IFS='.' read -ra version_parts <<< "$current_version" | ||
((version_parts[2]++)) | ||
new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}" | ||
jq --arg version "$new_version" '.version = $version' custom_components/electric_kiwi/manifest.json > custom_components/electric_kiwi/manifest.json.tmp && mv custom_components/electric_kiwi/manifest.json.tmp custom_components/electric_kiwi/manifest.json | ||
- name: Commit and push changes | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add custom_components/electric_kiwi/manifest.json | ||
git commit -m "Bump version to $(jq -r .version custom_components/electric_kiwi/manifest.json)" | ||
git push |