Gitea workflow to build docker image

This commit is contained in:
2026-07-08 10:52:15 +02:00
parent d3cdc7d4ba
commit 7bdf1e5df3
5 changed files with 51 additions and 115 deletions
+51
View File
@@ -0,0 +1,51 @@
name: Build and push ha-elegoo-spaghetti-detection image
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag'
required: true
type: string
default: 'v1.0.0'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Docker login
run: |
echo "${{ secrets.ACCESS_TOKEN }}" | docker login gitea.furb.it \
-u "${{ secrets.USERNAME }}" \
--password-stdin
# Build image with tag
- name: Build Docker image
working-directory: ./addon
run: |
docker build \
-f Dockerfile.standalone.base \
--label ha-elegoo-spaghetti-detection.tag=${{ inputs.tag }} \
-t gitea.furb.it/docker/ha-elegoo-spaghetti-detection:latest \
-t gitea.furb.it/docker/ha-elegoo-spaghetti-detection:${{ inputs.tag }} \
.
# Push images
- name: Push Docker images
run: |
docker push gitea.furb.it/docker/ha-elegoo-spaghetti-detection:latest
docker push gitea.furb.it/docker/ha-elegoo-spaghetti-detection:${{ inputs.tag }}
# Create release using gitea-release-action
- name: Create release
uses: akkuman/gitea-release-action@v1
with:
server: "https://gitea.furb.it"
token: ${{ secrets.ACCESS_TOKEN }}
repository: Docker/ha-elegoo-spaghetti-detection
tag_name: ${{ inputs.tag }}
name: ${{ inputs.tag }}
body: "Docker image: `gitea.furb.it/docker/ha-elegoo-spaghetti-detection:${{ inputs.tag }}`"
-6
View File
@@ -1,6 +0,0 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
-66
View File
@@ -1,66 +0,0 @@
name: CI
on:
push:
tags-ignore:
- "v*"
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Validate JSON
run: |
python -m json.tool hacs.json > /dev/null
python -m json.tool repository.json > /dev/null
python -m json.tool custom_components/elegoo_spaghetti_detection/manifest.json > /dev/null
python -m json.tool custom_components/elegoo_spaghetti_detection/translations/en.json > /dev/null
- name: Validate Python syntax
run: python -m compileall custom_components/elegoo_spaghetti_detection addon/rootfs/app
- name: Validate YAML
run: |
python -m pip install pyyaml
python - <<'PY'
from pathlib import Path
import yaml
class Loader(yaml.SafeLoader):
pass
def unknown_constructor(loader, tag_suffix, node):
if isinstance(node, yaml.MappingNode):
return loader.construct_mapping(node)
if isinstance(node, yaml.SequenceNode):
return loader.construct_sequence(node)
return loader.construct_scalar(node)
Loader.add_multi_constructor("!", unknown_constructor)
paths = [
Path("docker-compose.yaml"),
Path("addon/config.yaml"),
Path("custom_components/elegoo_spaghetti_detection/services.yaml"),
Path(".github/workflows/ci.yaml"),
Path(".github/workflows/hassfest.yaml"),
Path(".github/workflows/validate.yaml"),
Path(".github/dependabot.yml"),
*Path("examples").glob("*.yaml"),
]
for path in sorted(paths):
with path.open("r", encoding="utf-8") as handle:
yaml.load(handle, Loader=Loader)
PY
-20
View File
@@ -1,20 +0,0 @@
name: Validate with hassfest
on:
push:
tags-ignore:
- "v*"
pull_request:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: home-assistant/actions/hassfest@master
-23
View File
@@ -1,23 +0,0 @@
name: Validate
on:
push:
tags-ignore:
- "v*"
pull_request:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
permissions:
contents: read
jobs:
validate-hacs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: HACS validation
uses: hacs/action@main
with:
category: integration