Skip to content

Release integration 1.1.0 #22

Release integration 1.1.0

Release integration 1.1.0 #22

name: Publish Release
on:
push:
branches:
- main
paths:
- ".github/workflows/publish-release.yml"
- "brand/**"
- "CHANGELOG.md"
- "hacs.json"
- "icon.png"
- "logo.png"
- "custom_components/worx_vision_cloud/brand/**"
- "custom_components/worx_vision_cloud/manifest.json"
workflow_dispatch:
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read integration version
id: version
shell: bash
run: |
version="$(python - <<'PY'
import json
from pathlib import Path
manifest = json.loads(Path("custom_components/worx_vision_cloud/manifest.json").read_text())
print(manifest["version"])
PY
)"
echo "version=${version}" >> "$GITHUB_OUTPUT"
- name: Prepare release notes
shell: bash
run: |
python - <<'PY'
from pathlib import Path
version = "${{ steps.version.outputs.version }}"
lines = Path("CHANGELOG.md").read_text(encoding="utf-8").splitlines()
capture = False
notes = []
for line in lines:
if line.startswith("## "):
heading = line[3:].strip()
if capture:
break
capture = heading == version
continue
if capture:
notes.append(line)
text = "\n".join(notes).strip() or f"Worx Vision Cloud PLUS {version}"
Path("RELEASE_NOTES.md").write_text(text + "\n", encoding="utf-8")
PY
- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
TAG_NAME: ${{ steps.version.outputs.version }}
shell: bash
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -f "$TAG_NAME" "$GITHUB_SHA"
git push --force origin "refs/tags/$TAG_NAME"
if gh release view "$TAG_NAME" >/dev/null 2>&1; then
gh release edit "$TAG_NAME" --title "$TAG_NAME" --notes-file RELEASE_NOTES.md --latest
else
gh release create "$TAG_NAME" --target "$GITHUB_SHA" --title "$TAG_NAME" --notes-file RELEASE_NOTES.md --latest
fi