ci: release on every push to master with date-based versioning (vYYYY.MM.DD)

This commit is contained in:
Levi committed 2026-10-08 07:26:13 +01:00
1 parent 37df5732b7
commit 9da7cb8b22
1 file changed
+13 -4
+13 -4
View File
@@ -3,8 +3,6 @@ name: Release
on: on:
push: push:
branches: [master] branches: [master]
paths:
- custom_components/nvidia_shield/manifest.json
workflow_dispatch: workflow_dispatch:
env: env:
@@ -24,10 +22,21 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Read version from manifest.json # Date-based versioning: vYYYY.MM.DD.
# Priority: an unreleased manifest version wins (bump manifest.json to
# force a specific version); otherwise fall back to today's date, so a
# plain push to master produces/updates the day's release. The
# tag-exists check below dedupes same-day pushes.
- name: Determine release version
id: version id: version
run: | run: |
VERSION=$(jq -r .version custom_components/nvidia_shield/manifest.json) MANIFEST_VERSION=$(jq -r .version custom_components/nvidia_shield/manifest.json)
DATE_VERSION=$(date -u +%Y.%m.%d)
if git ls-remote --tags origin "refs/tags/v$MANIFEST_VERSION" | grep -q .; then
VERSION="$DATE_VERSION"
else
VERSION="$MANIFEST_VERSION"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT" echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"