46 lines
1.2 KiB
YAML
46 lines
1.2 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
release:
|
|
name: Build & publish GitHub release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out the repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Validate tag/manifest parity
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
tag="${GITHUB_REF_NAME}"
|
|
version="v${tag#v}"
|
|
manifest_version="$(python -c 'import json,os,sys; \
|
|
p=os.path.join("custom_components","main_gate_controller","manifest.json"); \
|
|
sys.exit(0) if False else print(json.load(open(p))["version"])')"
|
|
echo "Tag version: $version"
|
|
echo "Manifest version: $manifest_version"
|
|
if [ "$version" != "$manifest_version" ]; then
|
|
echo "ERROR: Manifest version does not match the tag."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Zip integration
|
|
shell: bash
|
|
run: |
|
|
cd custom_components
|
|
zip -r ../main_gate_controller.zip main_gate_controller
|
|
|
|
- name: Create GitHub release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
generate_release_notes: true
|
|
files: main_gate_controller.zip
|