diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..b09bc8d --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,24 @@ +name: Release + +on: + release: + types: [published] + workflow_dispatch: + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Create release zip from git-tracked integration files + run: git archive --format=zip -o pvoutput_publisher.zip HEAD:custom_components/pvoutput_publisher + + - name: Upload zip asset to GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: pvoutput_publisher.zip diff --git a/docs/developers.md b/docs/developers.md index 8d49536..fd64d77 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -108,9 +108,10 @@ To create a new release for users (via HACS and GitHub): ### Step 4: Publish GitHub Release (HACS Changelog) HACS pulls release changelogs directly from **GitHub Releases**: -1. On GitHub, navigate to **Releases > Draft a new release** (or use `gh release create X.Y.Z`). -2. Tag version: `X.Y.Z` (e.g. `2.0.0`). -3. Title: `Release X.Y.Z`. +1. On GitHub, navigate to **Releases > Draft a new release** (or use `gh release create vX.Y.Z`). +2. Tag version: `vX.Y.Z` (e.g. `v2.1.0`). +3. Title: `Release vX.Y.Z` (or `vX.Y.Z`). 4. **Description:** Copy and paste the exact markdown section from `CHANGELOG.md` for this version into the GitHub release description. 5. Click **Publish Release**. -6. HACS will automatically detect the new release and display the release notes inside Home Assistant for updating users. +6. Publishing the release automatically triggers [`.github/workflows/release.yaml`](file:///Users/spowis/Documents/code/HomeAssistant-PVOutputPublisher/.github/workflows/release.yaml), which builds `pvoutput_publisher.zip` from `custom_components/pvoutput_publisher` and attaches it to the release so HACS can track download counts. +7. HACS will automatically detect the new release and display the release notes inside Home Assistant for updating users. diff --git a/hacs.json b/hacs.json index 06c8fc9..d99df61 100644 --- a/hacs.json +++ b/hacs.json @@ -1,4 +1,6 @@ { "name": "PVOutput Publisher", - "render_readme": true + "render_readme": true, + "zip_release": true, + "filename": "pvoutput_publisher.zip" }