# # Copyright (C) 2023 AuxXxilium and Ing # # This is free software, licensed under the MIT License. # See /LICENSE for more information. # name: Data on: release: types: - created workflow_dispatch: inputs: push: description: "push" default: false type: boolean jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@main with: ref: page - name: Init Env run: | git config --global user.email "info@auxxxilium.tech" git config --global user.name "AuxXxilium" sudo timedatectl set-timezone "Europe/Berlin" sudo apt update sudo apt install -y build-essential libtool pkgconf libzstd-dev liblzma-dev libssl-dev busybox dialog curl xz-utils cpio sed qemu-utils YQ=$(command -v yq) if [ -z "${YQ}" ] || ! ${YQ} --version 2>/dev/null | grep -q "v4."; then wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O "${YQ:-"/usr/bin/yq"}" && chmod +x "${YQ:-"/usr/bin/yq"}" fi - name: Get Addon Data for Arc run: | REPO="https://github.com/AuxXxilium/arc-addons" PRERELEASE="true" TAG="" if [ "${PRERELEASE}" = "true" ]; then TAG="$(curl -skL --connect-timeout 10 "${REPO}/tags" | grep /refs/tags/.*\.zip | sed -r 's/.*\/refs\/tags\/(.*)\.zip.*$/\1/' | sort -rV | head -1)" else LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${REPO}/releases/latest")" TAG="${LATESTURL##*/}" fi [ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}" rm -f addons.zip STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/addons-${TAG}.zip" -o "addons.zip") if [ $? -ne 0 -o ${STATUS:-0} -ne 200 ]; then echo "Download failed" exit 1 fi mkdir -p "mnt/p3/addons" unzip addons.zip -d "mnt/p3/addons" for i in $(find "mnt/p3/addons" -type f -name "*.addon"); do if [ -f "${i}" ]; then mkdir -p "mnt/p3/addons/$(basename "${i}" .addon)" tar -xaf "${i}" -C "mnt/p3/addons/$(basename "${i}" .addon)" fi done rm -f addons.zip - name: Get Config Data for Arc run: | REPO="https://github.com/AuxXxilium/arc-configs" LATESTURL="$(curl -skL --connect-timeout 10 -w %{url_effective} -o /dev/null "${REPO}/releases/latest")" TAG="${LATESTURL##*/}" [ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}" rm -f configs.zip STATUS=$(curl -kL --connect-timeout 10 -w "%{http_code}" "${REPO}/releases/download/${TAG}/configs-${TAG}.zip" -o "configs.zip") if [ $? -ne 0 -o ${STATUS:-0} -ne 200 ]; then echo "Download failed" exit 1 fi mkdir -p "mnt/p3/configs" unzip configs.zip -d "mnt/p3/configs" rm -f configs.zip - name: Get data run: | pip install -r scripts/requirements.txt python scripts/functions.py getmodels -w "." -j "docs/models.json" python scripts/functions.py getaddons -w "." -j "docs/addons.json" python scripts/functions.py getpats -w "." -j "docs/pats.json" - name: Upload to Artifacts if: success() uses: actions/upload-artifact@v4 with: name: docs path: | docs/*.json retention-days: 5 - name: Check and Push if: success() && (inputs.push == true || github.event.action == 'created') run: | echo "Git push ..." # git checkout main git pull status=$(git status -s | grep -E "docs" | 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