This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Bump manifest version on release | ||
| on: | ||
| release: | ||
| types: [published] # läuft, wenn ein Release veröffentlicht wurde | ||
| workflow_dispatch: # optional: zum manuellen Testen | ||
| jobs: | ||
| bump-manifest: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Determine version from release tag | ||
| id: v | ||
| run: | | ||
| TAG="${{ github.event.release.tag_name }}" | ||
| if [ -z "$TAG" ]; then | ||
| echo "Kein Release-Tag gefunden." >&2 | ||
| exit 1 | ||
| fi | ||
| # führendes v/V entfernen (z. B. v2.5.0 -> 2.5.0) | ||
| VERSION="${TAG#v}" | ||
| VERSION="${VERSION#V}" | ||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| - name: Update manifest.json | ||
| run: | | ||
| FILE="custom_components/alternative_time/manifest.json" # Repo-Pfad (mit /) | ||
| if [ ! -f "$FILE" ]; then | ||
| echo "Datei nicht gefunden: $FILE" >&2 | ||
| exit 1 | ||
| fi | ||
| python - <<'PY' | ||
| import json | ||
| from pathlib import Path | ||
| p = Path("custom_components/alternative_time/manifest.json") | ||
| data = json.loads(p.read_text(encoding="utf-8")) | ||
| data["version"] = "${{ steps.v.outputs.version }}" | ||
| p.write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n", encoding="utf-8") | ||
| print("manifest.json aktualisiert auf", data["version"]) | ||
| PY | ||
| - name: Create pull request | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| commit-message: "chore: bump manifest version to ${{ steps.v.outputs.version }} (from release ${{ steps.v.outputs.tag }})" | ||
| branch: chore/bump-manifest-${{ steps.v.outputs.version }} | ||
| title: "chore: bump manifest version to ${{ steps.v.outputs.version }}" | ||
| body: | | ||
| Dieses PR wurde automatisch aus dem Release `${{ steps.v.outputs.tag }}` erstellt | ||
| und setzt `custom_components/alternative_time/manifest.json` auf `${{ steps.v.outputs.version }}`. | ||
| add-paths: | | ||
| custom_components/alternative_time/manifest.json | ||
| labels: automation, version-bump | ||