66 lines
2.1 KiB
YAML
66 lines
2.1 KiB
YAML
name: 🐳 Build ubuntu-latest Runner Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'docker-ubuntu-latest/Dockerfile'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
# Bootstraps itself — runs on docker:host (no container spawned)
|
|
# Docker CLI available via tools volume from initContainer
|
|
runs-on: docker
|
|
|
|
steps:
|
|
- name: 🔎 Checkout
|
|
run: |
|
|
git clone \
|
|
--depth 1 \
|
|
--branch "${{ gitea.ref_name }}" \
|
|
"http://${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_PASSWORD }}@gitea.mod.home/ansible/ansible-runner.git" \
|
|
.
|
|
|
|
- name: 🏷️ Set Image Tags
|
|
id: tags
|
|
run: |
|
|
REGISTRY="gitea.mod.home"
|
|
ORG="${{ gitea.repository_owner }}"
|
|
IMAGE="ubuntu-act-runner"
|
|
SHORT_SHA="${{ gitea.sha }}"
|
|
SHORT_SHA="${SHORT_SHA:0:8}"
|
|
|
|
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: |
|
|
docker build \
|
|
-t ${{ steps.tags.outputs.tag_latest }} \
|
|
-t ${{ steps.tags.outputs.tag_sha }} \
|
|
-f docker-ubuntu-latest/Dockerfile \
|
|
docker-ubuntu-latest/
|
|
|
|
- name: 🐳 Push Image
|
|
run: |
|
|
docker push ${{ steps.tags.outputs.tag_latest }}
|
|
docker push ${{ steps.tags.outputs.tag_sha }}
|
|
|
|
- name: 📨 Telegram Notification
|
|
if: always()
|
|
run: |
|
|
curl -s -X POST \
|
|
"https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
|
|
-d "chat_id=${{ secrets.TELEGRAM_CHAT_ID }}" \
|
|
-d "text=🐳 Build ubuntu-act-runner:${{ steps.tags.outputs.short_sha }} — ${{ job.status }}"
|