82 lines
2.6 KiB
YAML
82 lines
2.6 KiB
YAML
name: List of Services README Generation
|
|
|
|
on:
|
|
schedule:
|
|
- cron: 30 */2 * * *
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
readme-services:
|
|
name: Generate Services List
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: main
|
|
|
|
- name: Install yq & aha (silent)
|
|
run: |
|
|
set -e
|
|
sudo apt-get -qq update >/dev/null
|
|
if sudo apt-get -qq install -y yq aha >/dev/null 2>&1; then
|
|
echo "✅ Successfully installed yq and aha."
|
|
else
|
|
echo "❌ Failed to install yq and/or aha." >&2
|
|
exit 1
|
|
fi
|
|
|
|
- name: Generate system info (ANSI preserved)
|
|
id: gen-sysinfo
|
|
uses: appleboy/ssh-action@v1.2.3
|
|
with:
|
|
host: 192.168.1.254
|
|
username: charish
|
|
port: 22
|
|
key: ${{ secrets.RUNNER_SSH_PRIVATE_KEY }}
|
|
capture_stdout: true
|
|
script: neofetch --stdout
|
|
|
|
- name: Convert ANSI to HTML
|
|
run: |
|
|
echo "${{ steps.gen-sysinfo.outputs.stdout }}" > sysinfo.ansi
|
|
cat sysinfo.ansi | aha --black > sysinfo.html
|
|
|
|
- name: Generate service list
|
|
run: |
|
|
yq 'explode(.) | .services | to_entries | map({"service": .key, "image": .value.image, "description": (.value.labels."homepage.description" // "")})' docker-compose.yml > services.yml
|
|
|
|
- name: Generate Markdown Table
|
|
uses: gazab/create-markdown-table@v1.0.7
|
|
id: service-table
|
|
with:
|
|
file: ./services.yml
|
|
|
|
- name: Regenerate README (theme-adaptive)
|
|
run: |
|
|
{
|
|
echo "# System Info"
|
|
echo ""
|
|
echo '<details><summary>View Neofetch Output</summary>'
|
|
echo '<div id="neofetch-output">'
|
|
echo '<style>'
|
|
echo '#neofetch-output pre { font-family: monospace; border-radius: 10px; padding: 1em; overflow-x: auto; }'
|
|
echo '@media (prefers-color-scheme: dark) { #neofetch-output pre { background: #000; color: #fff; } }'
|
|
echo '@media (prefers-color-scheme: light) { #neofetch-output pre { background: #f8f8f8; color: #000; } }'
|
|
echo '</style>'
|
|
cat sysinfo.html
|
|
echo '</div>'
|
|
echo '</details>'
|
|
echo ""
|
|
echo "# List of Services"
|
|
echo ""
|
|
echo "${{ steps.service-table.outputs.table }}"
|
|
} > README.md
|
|
|
|
- name: Add/Commit README.md
|
|
uses: EndBug/add-and-commit@v9
|
|
with:
|
|
message: "chore: Update README"
|
|
add: "README.md"
|