-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (45 loc) · 1.45 KB
/
Copy pathrelease.yml
File metadata and controls
49 lines (45 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Release
on:
push:
branches:
- "claude/release-latest-commit-**"
tags:
- "v*"
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Resolve tag and publish release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
TAG="${GITHUB_REF_NAME}"
else
VER="$(python3 -c "import json; print(json.load(open('custom_components/smart_climate/manifest.json'))['version'])")"
TAG="v${VER}"
fi
echo "Releasing ${TAG}"
if git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
echo "Tag ${TAG} already exists on origin; skipping tag creation."
else
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "${TAG}" -m "Smart Climate Controller ${TAG}"
git push origin "${TAG}"
fi
if gh release view "${TAG}" >/dev/null 2>&1; then
echo "Release ${TAG} already exists; nothing to do."
else
gh release create "${TAG}" \
--title "${TAG}" \
--generate-notes \
--verify-tag
fi