diff --git a/.gitea/workflows/compose-services-readme.yml b/.gitea/workflows/compose-services-readme.yml index dcd1e992..82975f73 100644 --- a/.gitea/workflows/compose-services-readme.yml +++ b/.gitea/workflows/compose-services-readme.yml @@ -7,63 +7,75 @@ on: jobs: readme-services: - name: Generate Services List - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 - with: - ref: 'main' + name: Generate Services List + runs-on: ubuntu-latest - - name: Install yq - uses: dcarbone/install-yq-action@4075b4dca348d74bd83f2bf82d30f25d7c54539b # v1.3.1 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: main - - name: Generate system info - 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 + - 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: Convert ANSI to HTML - id: ansi-to-html - uses: justinm/actions-ansi-to-html@v1.0.0 - with: - input: ${{ steps.gen-sysinfo.outputs.stdout }} + - 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: 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: Convert ANSI to HTML + run: | + echo "${{ steps.gen-sysinfo.outputs.stdout }}" > sysinfo.ansi + cat sysinfo.ansi | aha --black > sysinfo.html - - name: Generate Markdown Table - uses: gazab/create-markdown-table@6686233d7008e8d8b9d4bbdbfd1fb1ae510019f0 # v1.0.7 - id: service-table - with: - file: ./services.yml + - 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: Regenerate README - run: | - # Write system info as a literal code block - { - echo '```' - 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: 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 '
View Neofetch Output' + echo '
' + echo '' + cat sysinfo.html + echo '
' + echo '
' + echo "" + echo "# List of Services" + echo "" + echo "${{ steps.service-table.outputs.table }}" + } > README.md - - name: Add/Commit README.md - id: commit-readme - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 - with: - message: "chore: Update README" - add: "README.md" \ No newline at end of file + - name: Add/Commit README.md + uses: EndBug/add-and-commit@v9 + with: + message: "chore: Update README" + add: "README.md"