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@v4 - 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 contains the full custom_components tree so HACS / manual users # can extract directly into their HA config directory. zip -r solar-of-things-ha.zip custom_components/solar_of_things/ \ -x "*.pyc" -x "__pycache__/*" 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}" # Grab lines between current version header and next version header 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 echo "notes_file=release_notes.txt" >> "$GITHUB_OUTPUT" - name: Create GitHub Release & upload asset uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.ref_name }} name: "${{ github.ref_name }} — Solar of Things HA Integration" body_path: release_notes.txt draft: false files: solar-of-things-ha.zip