Skip to content

Data: Update download index #7944

Data: Update download index

Data: Update download index #7944

name: "Data: Generate Armbian download index"
on:
repository_dispatch:
types: ["Data: Update download index"]
workflow_dispatch:
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
env:
SOURCE_OF_TRUTH: "rsync://fi.mirror.armbian.de"
jobs:
Webindex:
name: "Generate JSON Index"
runs-on: ubuntu-24.04
if: ${{ github.repository_owner == 'Armbian' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout build framework repository
uses: actions/checkout@v6
with:
repository: armbian/build
fetch-depth: 1
clean: false
path: build
- name: Checkout OS repository
uses: actions/checkout@v6
with:
repository: armbian/os
fetch-depth: 1
clean: false
path: os
- name: Checkout armbian.github.io repository
uses: actions/checkout@v6
with:
repository: armbian/armbian.github.io
fetch-depth: 0
clean: false
path: armbian.github.io
- name: Checkout this repo (script)
uses: actions/checkout@v6
with:
fetch-depth: 1
clean: false
path: runner
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq jc rsync curl
- name: Get exposed.map
run: |
curl -fsSL -o "${GITHUB_WORKSPACE}/exposed.map" https://github.armbian.com/release-targets/exposed.map
- name: Generate armbian-images.json (with Bigin company enrichment)
working-directory: runner
env:
# Zoho OAuth credentials for Bigin enrichment
ZOHO_CLIENT_ID: ${{ secrets.ZOHO_CLIENT_ID }}
ZOHO_CLIENT_SECRET: ${{ secrets.ZOHO_CLIENT_SECRET }}
ZOHO_REFRESH_TOKEN: ${{ secrets.ZOHO_REFRESH_TOKEN }}
# You can also disable enrichment if needed:
# BIGIN_ENABLE: "false"Infrastructure: Update redirector
run: |
set -euo pipefail
OUT="armbian-images.json" \
OS_DIR="${GITHUB_WORKSPACE}" \
BOARD_DIR="${GITHUB_WORKSPACE}/build/config/boards" \
SOURCE_OF_TRUTH="${SOURCE_OF_TRUTH}" \
./scripts/generate-armbian-images-json.sh
# Copy into workspace root so later steps can reference easily
cp armbian-images.json "${GITHUB_WORKSPACE}/armbian-images.json"
- name: Download and compress torrent files
run: |
set -euo pipefail
SOURCE=$(mktemp -d)
DESTINATION=$(mktemp -d)
rsync -zqvr \
--include="*/archive/*.torrent" \
--exclude="/*/*/*" \
--exclude="_*/" \
--exclude="control" \
--exclude="quotes.txt" \
--exclude="*/all-torrents.zip" \
"${SOURCE_OF_TRUTH}/dl/" "${SOURCE}"
find ${SOURCE}/. -mindepth 3 -exec mv -i -- {} ${DESTINATION}/ \;
zip -qj "${GITHUB_WORKSPACE}/all-torrents.zip" ${DESTINATION}/*.torrent
- name: Commit changes if any
run: |
set -euo pipefail
cd armbian.github.io
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git fetch origin data
git checkout data
mkdir -p data
cp "${GITHUB_WORKSPACE}/armbian-images.json" data/
cp "${GITHUB_WORKSPACE}/all-torrents.zip" data/
git add data/armbian-images.json data/all-torrents.zip
if ! git diff --cached --quiet; then
git commit -m "Update armbian-images.json and all-torrents.zip"
# Push with retry logic
max_attempts=3
attempt=1
while [ $attempt -le $max_attempts ]; do
if git push origin data; then
echo "Successfully pushed to data branch"
exit 0
fi
# Pull with rebase to resolve conflicts
echo "Push failed, attempting to pull and rebase..." >&2
if ! git pull --rebase origin data; then
echo "Pull/rebase failed, will retry push..." >&2
fi
attempt=$((attempt + 1))
done
echo "Failed to push after $max_attempts attempts" >&2
exit 1
fi
- name: "Generate directory"
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.DISPATCH }}
event-type: "Infrastructure: Update redirector"