File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Create GitHub Release
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ paths :
8+ - " custom_components/dnsdist/manifest.json"
9+ - " README.md"
10+
11+ permissions :
12+ contents : write
13+
14+ jobs :
15+ release :
16+ name : Auto Release on Version Change
17+ runs-on : ubuntu-latest
18+
19+ steps :
20+ - name : Checkout repository
21+ uses : actions/checkout@v4
22+
23+ - name : Set up Python
24+ uses : actions/setup-python@v5
25+ with :
26+ python-version : " 3.13"
27+
28+ - name : Extract version from manifest.json
29+ id : manifest
30+ run : |
31+ import json
32+ with open("custom_components/dnsdist/manifest.json") as f:
33+ manifest = json.load(f)
34+ version = manifest.get("version", "0.0.0")
35+ print(f"::set-output name=version::{version}")
36+ shell : python
37+
38+ - name : Check if tag already exists
39+ id : tag_check
40+ run : |
41+ VERSION=${{ steps.manifest.outputs.version }}
42+ if git rev-parse "v$VERSION" >/dev/null 2>&1; then
43+ echo "Tag v$VERSION already exists. Skipping release."
44+ echo "exists=true" >> $GITHUB_OUTPUT
45+ else
46+ echo "exists=false" >> $GITHUB_OUTPUT
47+ fi
48+
49+ - name : Create release
50+ if : steps.tag_check.outputs.exists == 'false'
51+ uses : softprops/action-gh-release@v2
52+ with :
53+ tag_name : v${{ steps.manifest.outputs.version }}
54+ name : Release v${{ steps.manifest.outputs.version }}
55+ body_path : README.md
56+ draft : false
57+ prerelease : false
You can’t perform that action at this time.
0 commit comments