name: release on: push: tags: ["v*"] jobs: release: runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # HACS and Home Assistant both read the version from manifest.json, not # from the tag. If the two disagree, HACS offers "v0.2.0" and installs # something that reports itself as 0.1.0 -- which is exactly the state # this repo was in before it had any releases at all. Fail the release # rather than publish that. - name: Check manifest.json version matches the tag run: | tag_version="${GITHUB_REF_NAME#v}" manifest_version="$(python3 -c "import json; print(json.load(open('custom_components/openai_compatible/manifest.json'))['version'])")" echo "tag: $GITHUB_REF_NAME -> $tag_version" echo "manifest: $manifest_version" if [ "$tag_version" != "$manifest_version" ]; then echo "::error::tag ${GITHUB_REF_NAME} implies version ${tag_version}, but manifest.json says ${manifest_version}. Bump the manifest and re-tag." exit 1 fi - name: Create the GitHub release env: GH_TOKEN: ${{ github.token }} run: | gh release create "$GITHUB_REF_NAME" \ --title "$GITHUB_REF_NAME" \ --generate-notes \ --verify-tag