Files
arc/.github/workflows/data.yml
AuxXxilium 1063f8697c workflow: rework
Signed-off-by: AuxXxilium <info@auxxxilium.tech>
2026-05-25 11:46:25 +02:00

119 lines
4.3 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
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
YQ_BIN="${YQ:-"/usr/bin/yq"}"
TMP_YQ_BIN="${YQ_BIN}.part"
rm -f "${TMP_YQ_BIN}"
curl -fsSL --connect-timeout 10 --retry 5 --retry-delay 2 --retry-all-errors https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o "${TMP_YQ_BIN}"
[ -s "${TMP_YQ_BIN}" ] || exit 1
mv -f "${TMP_YQ_BIN}" "${YQ_BIN}"
chmod +x "${YQ_BIN}"
fi
- name: Get Addon Data for Arc
run: |
set -euo pipefail
. scripts/github_release.sh
REPO_WEB="https://github.com/AuxXxilium/arc-addons"
REPO_API="https://api.github.com/repos/AuxXxilium/arc-addons/releases"
PRERELEASE="true"
TAG=""
if [ "${PRERELEASE}" = "true" ]; then
TAG="$(github_latest_tag "${REPO_API}")"
else
LATESTURL="$(curl -fsSL --connect-timeout 10 --retry 3 --retry-delay 1 --retry-all-errors -w %{url_effective} -o /dev/null "${REPO_WEB}/releases/latest")"
TAG="${LATESTURL##*/}"
fi
[ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}"
rm -f addons.zip
download_validated_zip "${REPO_WEB}/releases/download/${TAG}/addons-${TAG}.zip" "addons.zip" 1024
mkdir -p "mnt/p3/addons"
unzip -oq 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: |
set -euo pipefail
. scripts/github_release.sh
REPO="https://github.com/AuxXxilium/arc-configs"
LATESTURL="$(curl -fsSL --connect-timeout 10 --retry 3 --retry-delay 1 --retry-all-errors -w %{url_effective} -o /dev/null "${REPO}/releases/latest")"
TAG="${LATESTURL##*/}"
[ "${TAG:0:1}" = "v" ] && TAG="${TAG:1}"
rm -f configs.zip
download_validated_zip "${REPO}/releases/download/${TAG}/configs-${TAG}.zip" "configs.zip" 1024
mkdir -p "mnt/p3/configs"
unzip -oq 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