Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
version: 2
updates:
# Enable version updates for pip
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
# Enable version updates for pip
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10

# Enable version updates for Docker
- package-ecosystem: "docker"
# Look for a `Dockerfile` in the `root` directory
directory: "/"
# Check for updates once a week
schedule:
interval: "weekly"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

# Enable version updates for Docker
- package-ecosystem: "docker"
# Look for a `Dockerfile` in the `root` directory
directory: "/"
# Check for updates once a week
schedule:
interval: "weekly"
162 changes: 0 additions & 162 deletions .github/workflows/build-deploy.yml

This file was deleted.

91 changes: 91 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Builds and publishes multi-platform Docker images after Python Build completes successfully.
# Pushes to Docker Hub on version tags (v*) or dev branch.
name: Build and Deploy Docker Image

on:
workflow_run:
workflows: ["Python CI"]
branches: ['**']
types:
- completed

# Cancel a currently running workflow from the same PR, branch or tag when a new workflow is triggered:
concurrency:
group: docker-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.workflow_run.id || github.ref }}
cancel-in-progress: true

env:
# github.repository as <account>/<repo>
IMAGE_NAME: acockburn/appdaemon

jobs:
# After building the Python package, build the Docker image
build_image:
name: Docker image
runs-on: ubuntu-latest
# Only run if tests passed and it's dev branch or a version tag
if: |
github.event.workflow_run.conclusion == 'success' &&
(
github.event.workflow_run.head_branch == 'dev' ||
startsWith(github.event.workflow_run.head_branch, 'v')
)
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download Python package
uses: actions/download-artifact@v7
with:
name: python-package
path: dist/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Docker buildx
uses: docker/[email protected]
# Login against a Docker registry (only with a tag or push on `dev` branch)
# https://github.com/docker/login-action
- name: Log into Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.IMAGE_NAME }}
# Customize the generation of Docker `latest` tag
# Tag with `latest` the git tags that do not have a "pre-release" component in the end (e.g. `3.0.0`)
# Avoid tagging with `latest` the git tag that have a "pre-release" component in the end (e.g. `3.0.0b1`)
# If no git tag, fallback to branch or PR name
tags: |
# If the git tag follows PEP440 conventions, use it as the resulting docker tag (both releases and pre-releases)
type=pep440,pattern={{version}}

# If the git tag does NOT have a pre-release ending (e.g. `3.0.0`), it is a release version to be tagged as `latest`
type=match,value=latest,pattern=pattern=^\d\.\d+\.\d+$

# If no git tag is used, fallback to tagging with branch or PR name
type=ref,event=branch
type=ref,event=pr

# Build and push Docker image with Buildx (push image only with a tag or push on `dev` branch)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/[email protected]
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/arm64/v8, linux/amd64, linux/arm/v7, linux/arm/v6
cache-from: type=gha
cache-to: type=gha,mode=max
85 changes: 85 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Builds Sphinx documentation after Python Build completes successfully.
# Uploads documentation artifact for review or deployment.
name: Build Documentation

on:
workflow_run:
workflows: ["Python CI"]
types:
- completed
push:
branches:
- 'dev'
tags:
- '**'
paths:
- '.github/workflows/build-docs.yml'
- 'docs/**'
- 'pyproject.toml'

# Cancel a currently running workflow from the same PR, branch or tag when a new workflow is triggered:
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_sha || github.sha }}
cancel-in-progress: true

jobs:
build_docs:
name: Documentation
runs-on: ubuntu-latest
# For workflow_run: only run if tests passed and it's dev or a version tag
# For push: always run
if: |
github.event_name == 'push' || (
github.event.workflow_run.conclusion == 'success' &&
(
github.event.workflow_run.head_branch == 'dev' ||
startsWith(github.event.workflow_run.head_branch, 'v')
)
)
permissions:
packages: write
env:
UV_LOCKED: true
UV_COMPILE_BYTECODE: true
UV_NO_EDITABLE: true
UV_NO_PROGRESS: true
steps:
- name: Checkout repository
uses: actions/checkout@v6
# https://github.com/actions/setup-python
- name: Install uv and set the python version
id: setup-uv
uses: astral-sh/setup-uv@v7
with:
# https://docs.astral.sh/uv/guides/integration/github/#using-uv-in-github-actions
# It is considered best practice to pin to a specific uv version
version: "0.9.26"
# https://github.com/astral-sh/setup-uv?tab=readme-ov-file#enable-caching
enable-cache: true
cache-dependency-glob: uv.lock
- name: Build documentation
# Options:
# -T Display the full traceback when an unhandled exception occurs
# -E Don't use a saved environment (the structure caching all cross-references), but rebuild it completely.
# -b Select the builder
# -d Select a different cache directory
# -D Override a configuration value set in the conf.py file
# -W Turn warnings into errors. This means that the build stops at the first warning and sphinx-build exits with exit status 1
# --keep-going With -W option, keep going processing when getting warnings to the end of build, and sphinx-build exits with exit status 1.
run: >
uv run
--group doc
python -m sphinx
-T -E
-b html
-d _build/doctrees
-D language=en
-W --keep-going
. _build/html
working-directory: docs
# Save the generated documentation as an artifact in Github
- name: Upload documentation
uses: actions/upload-artifact@v6
with:
name: python-doc-package
path: docs/_build/
Loading