74 lines
2.2 KiB
YAML
74 lines
2.2 KiB
YAML
name: 🐳 Build Ansible Act Runner Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'docker/Dockerfile'
|
|
workflow_dispatch:
|
|
inputs:
|
|
force_rebuild:
|
|
description: 'Force rebuild without cache'
|
|
required: false
|
|
default: 'false'
|
|
type: boolean
|
|
|
|
jobs:
|
|
build:
|
|
# Runs directly on the runner host to access the DinD sidecar
|
|
# DOCKER_HOST=tcp://localhost:2376 is already set via runner configmap
|
|
runs-on: docker
|
|
|
|
steps:
|
|
- name: 🔎 Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 🏷️ Set Image Tags
|
|
id: tags
|
|
run: |
|
|
REGISTRY="gitea.mod.home"
|
|
ORG="${{ gitea.repository_owner }}"
|
|
IMAGE="ansible-act-runner"
|
|
SHORT_SHA="${{ gitea.sha }}"
|
|
SHORT_SHA="${SHORT_SHA:0:8}"
|
|
|
|
echo "image=${REGISTRY}/${ORG}/${IMAGE}" >> $GITHUB_OUTPUT
|
|
echo "tag_latest=${REGISTRY}/${ORG}/${IMAGE}:latest" >> $GITHUB_OUTPUT
|
|
echo "tag_sha=${REGISTRY}/${ORG}/${IMAGE}:${SHORT_SHA}" >> $GITHUB_OUTPUT
|
|
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
|
|
|
|
- name: 🐳 Docker Login → Gitea Registry
|
|
run: |
|
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | \
|
|
docker login gitea.mod.home \
|
|
--username "${{ secrets.REGISTRY_USER }}" \
|
|
--password-stdin
|
|
|
|
- name: 🐳 Build Image
|
|
run: |
|
|
BUILD_ARGS=""
|
|
if [ "${{ inputs.force_rebuild }}" = "true" ]; then
|
|
BUILD_ARGS="--no-cache"
|
|
fi
|
|
|
|
docker build ${BUILD_ARGS} \
|
|
-t ${{ steps.tags.outputs.tag_latest }} \
|
|
-t ${{ steps.tags.outputs.tag_sha }} \
|
|
-f docker/Dockerfile \
|
|
docker/
|
|
|
|
- name: 🐳 Push Image
|
|
run: |
|
|
docker push ${{ steps.tags.outputs.tag_latest }}
|
|
docker push ${{ steps.tags.outputs.tag_sha }}
|
|
|
|
- name: 📨 Telegram Notification
|
|
uses: chapvic/telegram-notify@master
|
|
if: always()
|
|
with:
|
|
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
|
chat: ${{ secrets.TELEGRAM_CHAT_ID }}
|
|
status: ${{ job.status }}
|
|
title: "🐳 Build: ansible-act-runner:${{ steps.tags.outputs.short_sha }}"
|