Files
arc/.github/workflows/data.yml
AuxXxilium 45d7d0dad3 tree: full update
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2024-04-13 21:24:04 +02:00

60 lines
1.8 KiB
YAML

#
# Copyright (C) 2023 AuxXxilium <https://github.com/AuxXxilium> and Ing <https://github.com/wjz304>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
name: Data
on:
workflow_dispatch:
inputs:
push:
description: "push"
default: false
type: boolean
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Init Env
run: |
git config --global user.email "info@auxxxilium.tech"
git config --global user.name "AuxXxilium"
sudo timedatectl set-timezone "Europe/Berlin"
- name: Get models
run: |
. scripts/func.sh
models="{"
WORK_PATH="files/p3"
mkdir -p "${WORK_PATH}/configs"
getConfigs "${WORK_PATH}/configs"
for M in $(find "${WORK_PATH}/configs" -maxdepth 1 -name \*.yml 2>/dev/null | sed 's/.*\///; s/\.yml//'); do
models+="\"${M}\":["
for V in $(yq eval '.productvers | explode(.) | to_entries | map([.key])[] | .[]' "${WORK_PATH}/configs/${M}.yml" 2>/dev/null | sort -r); do
models+="\"${V}\","
done
models="${models%,}],"
done
models="${models%,}}"
echo "${models}" >docs/models.json
rm -rf "${WORK_PATH}/configs"
- name: Check and Push
if: success() && inputs.push == true
run: |
echo "Git push ..."
git pull
status=$(git status -s | grep -E 'docs/models.json' | awk '{printf " %s", $2}')
if [ -n "${status}" ]; then
git add ${status}
git commit -m "data: update $(date +%Y-%m-%d" "%H:%M:%S)"
git push -f
fi