push version update #163
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
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/mammotion/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: | | |
# Mammotion - Home Assistant Integration v${{ steps.get_version.outputs.version }} 🚀 | |
[![Discord](https://img.shields.io/discord/1247286396297678879)](https://discord.gg/vpZdWhJX8x) | |
This release brings new features and improvements to the Mammotion 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 Mammotion 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/mammotion/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/mammotion/manifest.json > custom_components/mammotion/manifest.json.tmp && mv custom_components/mammotion/manifest.json.tmp custom_components/mammotion/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/mammotion/manifest.json | |
git commit -m "Bump version to $(jq -r .version custom_components/mammotion/manifest.json)" | |
git push |