Skip to content

adding asterisk

adding asterisk #45

name: Create Release
on:
push:
branches:
- main
jobs:
create_release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get manifest.json info
id: manifest-info
run: echo "::set-output name=version::$(jq -r '.version' custom_components/htd/manifest.json)"
- name: Check if version is already published
run: |
VERSION="${{ steps.manifest-info.outputs.version }}"
echo "Version to check: $VERSION"
# Query the releases from GitHub API (or another registry if necessary)
RESPONSE=$(curl -s https://api.github.com/repos/hikirsch/htd-home-assistant/releases)
# Check if the version exists in the published releases
if echo "$RESPONSE" | grep -q "\"tag_name\": \"v$VERSION\""; then
echo "Version $VERSION has already been published. Failing the build."
exit 1
else
echo "Version $VERSION is not published. Proceeding."
fi
- name: Package
run: cd custom_components/htd && zip -r ../../htd.zip * && cd ../..
- name: Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: v${{ steps.manifest-info.outputs.version }}
tag_name: v${{ steps.manifest-info.outputs.version }}
draft: true
files: htd.zip