Initial commit.
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
name: List of Services README Generation
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: 30 */2 * * *
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
HC_VAULT_VERSION: "1.21.4"
|
||||
|
||||
jobs:
|
||||
readme-services:
|
||||
name: Generate Services List
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
with:
|
||||
ref: 'main'
|
||||
submodules: true
|
||||
|
||||
- name: Install yq
|
||||
uses: dcarbone/install-yq-action@4075b4dca348d74bd83f2bf82d30f25d7c54539b # v1.3.1
|
||||
|
||||
- name: Generate .env from Hashicorp Vault
|
||||
uses: https://git.trez.wtf/Trez/hc-vault-env@main
|
||||
with:
|
||||
HC_VAULT_VERSION: ${{ env.HC_VAULT_VERSION }}
|
||||
HC_VAULT_ADDR: ${{ secrets.TREZ_VAULT_ADDR }}
|
||||
HC_VAULT_AUTH: token
|
||||
HC_VAULT_TOKEN: ${{ secrets.VAULT_GITEA_TOKEN }}
|
||||
HC_VAULT_SECRETS_PATH: rinoa-docker/env
|
||||
|
||||
- name: Find docker-compose YAML files
|
||||
id: find-compose-files
|
||||
run: |
|
||||
COMPOSE_FILES=$(find . -type f -name "docker-compose*.yml" \
|
||||
-a ! -name "*windows*" \
|
||||
-a ! -name "*gui*" \
|
||||
-a ! -name "*macos*" \
|
||||
-a ! -name "*hivemind*" \
|
||||
-a ! -name "*server*" \
|
||||
| sort)
|
||||
|
||||
echo "compose_files<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "$COMPOSE_FILES" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
echo "Found Compose files:"
|
||||
echo "$COMPOSE_FILES"
|
||||
|
||||
- name: Generate combined service list
|
||||
run: |
|
||||
echo "Processing combined Compose files:"
|
||||
echo "${{ steps.find-compose-files.outputs.compose_files }}"
|
||||
|
||||
docker_compose_args=""
|
||||
while IFS= read -r f; do
|
||||
[ -z "$f" ] && continue
|
||||
docker_compose_args="$docker_compose_args -f $f"
|
||||
done <<< "${{ steps.find-compose-files.outputs.compose_files }}"
|
||||
|
||||
echo "Running: docker compose --env-file .env $docker_compose_args config"
|
||||
docker compose --env-file .env $docker_compose_args config > combined_compose.yml
|
||||
|
||||
echo "Extracting services..."
|
||||
yq eval -o=json '.services | to_entries | map({"service": .key, "image": (.value.image | sub("@sha256:.*$"; "") // "N/A")})' combined_compose.yml > temp_services.json
|
||||
|
||||
jq -s add temp_services.json | jq 'unique_by(.service)' > services.json
|
||||
|
||||
- name: Generate Markdown Table
|
||||
uses: gazab/create-markdown-table@6686233d7008e8d8b9d4bbdbfd1fb1ae510019f0 # v1.0.7
|
||||
id: service-table
|
||||
with:
|
||||
file: ./services.json
|
||||
|
||||
- name: Regenerate README
|
||||
run: |
|
||||
echo "# List of Services" > README.md
|
||||
echo -e "\n\n" >> README.md
|
||||
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"
|
||||
Reference in New Issue
Block a user