Release HA Component #15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release HA Component | |
| on: | |
| workflow_run: | |
| workflows: ["HACS Validation"] # Must match the name of the first workflow | |
| types: | |
| - completed | |
| permissions: | |
| contents: write # This is required for creating releases | |
| jobs: | |
| build: | |
| # Only run if the previous workflow succeeded | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Required for tagging and version history | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install setuptools wheel | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Extract version from manifest | |
| id: version | |
| run: | | |
| # Extract version from manifest.json | |
| VERSION=$(grep -o '"version": "[^"]*' custom_components/ha_zyxel/manifest.json | cut -d'"' -f4) | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "Version extracted: $VERSION" | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ env.VERSION }} | |
| name: v${{ env.VERSION }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |