Skip to content

Commit

Permalink
Add publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasddn committed Feb 7, 2025
1 parent 6af376d commit 47b0aa4
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish

on:
release:
types:
- published
workflow_dispatch:

jobs:
release:
name: Publish zip file
runs-on: ubuntu-latest
permissions:
contents: write
env:
INTEGRATION_PATH: ${{ github.workspace }}/custom_components/volvo_cars
steps:
- name: Check out code
uses: actions/checkout@v4.2.2

- name: Set version in manifest.json
run: |
# Extract version from tag (e.g., "refs/tags/v1.2.3" becomes "1.2.3")
version="${GITHUB_REF#refs/tags/v}"
echo "Setting version to ${version}"
# Update the "version" key in manifest.json (assumes a simple "version": "..." line)
sed -i -E "s/\"version\": \"[^\"]+\"/\"version\": \"${version}\"/" ${INTEGRATION_PATH}/manifest.json
- name: Zip
run: |
cd $INTEGRATION_PATH
zip volvo_cars.zip -r ./
pwd
ls -l *.zip
- name: Include zip in release
uses: softprops/action-gh-release@v2.2.1
with:
files: ${{ env.INTEGRATION_PATH }}/volvo_cars.zip
fail_on_unmatched_files: true
2 changes: 1 addition & 1 deletion custom_components/volvo_cars/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/thomasddn/ha-volvo-cars/issues",
"requirements": [],
"version": "1.3.0"
"version": "0.0.0"
}
4 changes: 3 additions & 1 deletion hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"name": "Volvo Cars",
"homeassistant": "2024.11.0",
"hide_default_branch": true,
"render_readme": true
"render_readme": true,
"zip_release": true,
"filename": "volvo_cars.zip"
}

0 comments on commit 47b0aa4

Please sign in to comment.