Skip to content

Bump home-assistant/actions #778

Bump home-assistant/actions

Bump home-assistant/actions #778

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Github Deploy
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
release:
types: [published]
workflow_dispatch:
inputs:
tag_name:
description: 'Release tag to deploy (e.g. v1.14.0)'
required: true
type: string
prerelease:
description: 'Is this a prerelease?'
required: true
type: boolean
default: false
concurrency:
group: gh-pages-deploy
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
strategy:
fail-fast: false
matrix:
python-version: ["3.14"]
steps:
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || github.ref }}
- name: HACS Action
uses: "hacs/action@1ebf01c408f29afcb6406bd431bc98fd8cbb15aa"
with:
category: "integration"
- name: HACS Hassfest
uses: "home-assistant/actions/hassfest@e91ad1948e57189485b9c1ad608af0c303946f89"
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
sudo apt-get install pngquant
uv sync
- name: Ruff
uses: astral-sh/ruff-action@0ce1b0bf8b818ef400413f810f8a11cdbda0034b
- name: Test with pytest
run: |
uv run pytest . --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov=custom_components.supernotify --cov-report=xml --cov-report=html
- name: Upload pytest test results
uses: actions/upload-artifact@v7
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Generate badges
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
uv run genbadge coverage -i coverage.xml -o badges/coverage.svg
uv run genbadge tests -i junit/test-results-${{ matrix.python-version }}.xml -o badges/tests.svg
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
TEMP_DIR=$(mktemp -d)
cd $TEMP_DIR
git clone --single-branch --branch badges https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git . 2>/dev/null
cp -r ${{ github.workspace }}/badges .
git add badges
if git commit -m "Update badges [skip ci]"; then
git push origin badges --force
echo "Badges updated successfully"
else
echo "No changes to badges"
fi
if: ${{ always() }}
- name: Deploy docs
# run in the build workflow since schemagen has homeassistant dependency
run: |
sudo apt-get install pngquant
uv sync --group docs
git config push.autoSetupRemote true
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git fetch origin gh-pages
if [ "${{ github.event_name }}" = "release" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ inputs.tag_name }}"
IS_PRERELEASE="${{ inputs.prerelease }}"
else
TAG="${{ github.event.release.tag_name }}"
IS_PRERELEASE="${{ github.event.release.prerelease }}"
fi
if [[ "$IS_PRERELEASE" = "true" ]]; then
echo "Deploying prerelease version: $TAG"
uv run mike deploy --update-aliases "$TAG" beta
else
echo "Deploying stable release: $TAG"
uv run mike deploy --update-aliases "$TAG" latest
uv run mike set-default latest
fi
else
echo "Deploying development docs"
uv run mike deploy --update-aliases dev
fi
git push origin gh-pages --force-with-lease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}