add act runner addon
This commit is contained in:
		
							
								
								
									
										39
									
								
								gitea_act_runner/Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								gitea_act_runner/Dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
ARG BUILD_FROM
 | 
			
		||||
FROM $BUILD_FROM
 | 
			
		||||
 | 
			
		||||
ENV LANG C.UTF-8
 | 
			
		||||
 | 
			
		||||
# Setup base system
 | 
			
		||||
ARG \
 | 
			
		||||
  BUILD_ARCH
 | 
			
		||||
 | 
			
		||||
# Install necessary dependencies
 | 
			
		||||
RUN apk add --no-cache git docker-cli python3 py3-pip && \
 | 
			
		||||
    curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | bash
 | 
			
		||||
 | 
			
		||||
# Install Ansible via pip
 | 
			
		||||
RUN pip3 install --no-cache-dir ansible
 | 
			
		||||
 | 
			
		||||
# Optional: Additional steps for SSH/GitHub authentication or configuration
 | 
			
		||||
 | 
			
		||||
# Copy your add-on scripts and configuration files
 | 
			
		||||
COPY run.sh /run.sh
 | 
			
		||||
RUN chmod +x /run.sh
 | 
			
		||||
 | 
			
		||||
CMD [ "/run.sh" ]
 | 
			
		||||
 | 
			
		||||
# Labels
 | 
			
		||||
LABEL \
 | 
			
		||||
    io.hass.name="Act Runner" \
 | 
			
		||||
    io.hass.description="Gitea act runner" \
 | 
			
		||||
    io.hass.arch="${BUILD_ARCH}" \
 | 
			
		||||
    io.hass.type="addon" \
 | 
			
		||||
    io.hass.version="v0.0.0"\
 | 
			
		||||
    maintainer="feres mezned" \
 | 
			
		||||
    org.opencontainers.image.title="Act runner" \
 | 
			
		||||
    org.opencontainers.image.description="Gitea act runner" \
 | 
			
		||||
    org.opencontainers.image.vendor="Home Assistant Local Add-ons" \
 | 
			
		||||
    org.opencontainers.image.authors="Feres MEZNED" \
 | 
			
		||||
    org.opencontainers.image.licenses="NO" \
 | 
			
		||||
    org.opencontainers.image.url="https://mezgit.duckdns.org/mezned/HAddons" \
 | 
			
		||||
    org.opencontainers.image.source="https://mezgit.duckdns.org/mezned/HAddons/gitea_act_runner" 
 | 
			
		||||
							
								
								
									
										34
									
								
								gitea_act_runner/config.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								gitea_act_runner/config.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
name: "Act Runner and Ansible Add-on"
 | 
			
		||||
version: "1.0.0"
 | 
			
		||||
slug: "act_runner_ansible"
 | 
			
		||||
description: "Home Assistant add-on that runs Act runner with Gitea integration."
 | 
			
		||||
arch:
 | 
			
		||||
  - aarch64
 | 
			
		||||
  - amd64
 | 
			
		||||
  - armhf
 | 
			
		||||
  - armv7
 | 
			
		||||
  - i386
 | 
			
		||||
startup: "application"
 | 
			
		||||
boot: "auto"
 | 
			
		||||
options:
 | 
			
		||||
  gitea_url: "https://your-gitea-instance.com"
 | 
			
		||||
  gitea_token: "your_token"
 | 
			
		||||
  repository: "user/repository"
 | 
			
		||||
  act_runner_options: "--secret-file my.secrets --env-file my.env"
 | 
			
		||||
schema:
 | 
			
		||||
  gitea_url:
 | 
			
		||||
    type: string
 | 
			
		||||
    description: "The URL of the Gitea server to register the Act runner."
 | 
			
		||||
    required: true
 | 
			
		||||
  gitea_token:
 | 
			
		||||
    type: string
 | 
			
		||||
    description: "The token for authenticating with Gitea."
 | 
			
		||||
    required: true
 | 
			
		||||
  repository:
 | 
			
		||||
    type: string
 | 
			
		||||
    description: "The Gitea repository to register the runner with, in 'user/repository' format."
 | 
			
		||||
    required: true
 | 
			
		||||
  act_runner_options:
 | 
			
		||||
    type: string
 | 
			
		||||
    description: "Additional options to pass to Act runner."
 | 
			
		||||
    required: false
 | 
			
		||||
							
								
								
									
										15
									
								
								gitea_act_runner/run.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								gitea_act_runner/run.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# Load configuration from Home Assistant
 | 
			
		||||
GITEA_URL=$(bashio::config 'gitea_url')
 | 
			
		||||
GITEA_TOKEN=$(bashio::config 'gitea_token')
 | 
			
		||||
REPOSITORY=$(bashio::config 'repository')
 | 
			
		||||
ACT_OPTIONS=$(bashio::config 'act_runner_options')
 | 
			
		||||
 | 
			
		||||
# Register Act runner with Gitea (if needed)
 | 
			
		||||
curl -X POST "$GITEA_URL/api/v1/repos/$REPOSITORY/actions/runners" \
 | 
			
		||||
     -H "Authorization: token $GITEA_TOKEN" \
 | 
			
		||||
     -d '{ "name": "Act Runner", "labels": ["self-hosted"] }'
 | 
			
		||||
 | 
			
		||||
# Run Act with specified options
 | 
			
		||||
act $ACT_OPTIONS
 | 
			
		||||
		Reference in New Issue
	
	Block a user