| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- name: Release
- on:
- push:
- tags:
- - "v*.*.*"
- permissions:
- contents: write
- jobs:
- release:
- name: Build & publish GitHub release
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v6
- - name: Read version from manifest
- id: version
- run: |
- VERSION=$(python3 -c "import json; print(json.load(open('custom_components/solar_of_things/manifest.json'))['version'])")
- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- echo "Building release for version $VERSION"
- - name: Build HACS release ZIP
- run: |
- zip -r solar-of-things-ha.zip custom_components/solar_of_things/ \
- -x "*.pyc" -x "__pycache__/*"
- echo "ZIP size: $(du -sh solar-of-things-ha.zip | cut -f1)"
- echo "ZIP contents:"
- unzip -l solar-of-things-ha.zip
- - name: Extract changelog section for this tag
- id: changelog
- run: |
- TAG="${GITHUB_REF_NAME}"
- VER="${TAG#v}"
- NOTES=$(awk "/^## \[${VER}\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md)
- if [ -z "$NOTES" ]; then
- NOTES=$(head -60 CHANGELOG.md)
- fi
- printf '%s' "$NOTES" > release_notes.txt
- - name: Create GitHub Release & upload asset
- uses: softprops/action-gh-release@v3
- with:
- tag_name: ${{ github.ref_name }}
- name: "${{ github.ref_name }} — Solar of Things HA Integration"
- body_path: release_notes.txt
- draft: false
- prerelease: false
- files: solar-of-things-ha.zip
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|