ANSI to HTML attempt 1.
This commit is contained in:
@@ -7,63 +7,75 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
readme-services:
|
readme-services:
|
||||||
name: Generate Services List
|
name: Generate Services List
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
||||||
with:
|
|
||||||
ref: 'main'
|
|
||||||
|
|
||||||
- name: Install yq
|
steps:
|
||||||
uses: dcarbone/install-yq-action@4075b4dca348d74bd83f2bf82d30f25d7c54539b # v1.3.1
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: main
|
||||||
|
|
||||||
- name: Generate system info
|
- name: Install yq & aha (silent)
|
||||||
id: gen-sysinfo
|
run: |
|
||||||
uses: appleboy/ssh-action@v1.2.3
|
set -e
|
||||||
with:
|
sudo apt-get -qq update >/dev/null
|
||||||
host: 192.168.1.254
|
if sudo apt-get -qq install -y yq aha >/dev/null 2>&1; then
|
||||||
username: charish
|
echo "✅ Successfully installed yq and aha."
|
||||||
port: 22
|
else
|
||||||
key: ${{ secrets.RUNNER_SSH_PRIVATE_KEY }}
|
echo "❌ Failed to install yq and/or aha." >&2
|
||||||
capture_stdout: true
|
exit 1
|
||||||
script: neofetch
|
fi
|
||||||
|
|
||||||
- name: Convert ANSI to HTML
|
- name: Generate system info (ANSI preserved)
|
||||||
id: ansi-to-html
|
id: gen-sysinfo
|
||||||
uses: justinm/actions-ansi-to-html@v1.0.0
|
uses: appleboy/ssh-action@v1.2.3
|
||||||
with:
|
with:
|
||||||
input: ${{ steps.gen-sysinfo.outputs.stdout }}
|
host: 192.168.1.254
|
||||||
|
username: charish
|
||||||
|
port: 22
|
||||||
|
key: ${{ secrets.RUNNER_SSH_PRIVATE_KEY }}
|
||||||
|
capture_stdout: true
|
||||||
|
script: neofetch --stdout
|
||||||
|
|
||||||
- name: Generate service list
|
- name: Convert ANSI to HTML
|
||||||
run: |
|
run: |
|
||||||
yq 'explode(.) | .services | to_entries | map({"service": .key, "image": .value.image, "description": (.value.labels."homepage.description" // "")})' docker-compose.yml > services.yml
|
echo "${{ steps.gen-sysinfo.outputs.stdout }}" > sysinfo.ansi
|
||||||
|
cat sysinfo.ansi | aha --black > sysinfo.html
|
||||||
|
|
||||||
- name: Generate Markdown Table
|
- name: Generate service list
|
||||||
uses: gazab/create-markdown-table@6686233d7008e8d8b9d4bbdbfd1fb1ae510019f0 # v1.0.7
|
run: |
|
||||||
id: service-table
|
yq 'explode(.) | .services | to_entries | map({"service": .key, "image": .value.image, "description": (.value.labels."homepage.description" // "")})' docker-compose.yml > services.yml
|
||||||
with:
|
|
||||||
file: ./services.yml
|
|
||||||
|
|
||||||
- name: Regenerate README
|
- name: Generate Markdown Table
|
||||||
run: |
|
uses: gazab/create-markdown-table@v1.0.7
|
||||||
# Write system info as a literal code block
|
id: service-table
|
||||||
{
|
with:
|
||||||
echo '```'
|
file: ./services.yml
|
||||||
cat <<'EOF'
|
|
||||||
${{ step.ansi-to-html.outputs.contents }}
|
|
||||||
EOF
|
|
||||||
echo '```'
|
|
||||||
echo ""
|
|
||||||
echo "# List of Services"
|
|
||||||
echo ""
|
|
||||||
echo "${{ steps.service-table.outputs.table }}"
|
|
||||||
} > README.md
|
|
||||||
|
|
||||||
|
- 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
|
- name: Add/Commit README.md
|
||||||
id: commit-readme
|
uses: EndBug/add-and-commit@v9
|
||||||
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
|
with:
|
||||||
with:
|
message: "chore: Update README"
|
||||||
message: "chore: Update README"
|
add: "README.md"
|
||||||
add: "README.md"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user