Skip to content

Data: Generate build engine inventory #555

Data: Generate build engine inventory

Data: Generate build engine inventory #555

name: "Data: Generate build engine inventory"
on:
schedule:
- cron: "0 */4 * * *"
workflow_dispatch:
repository_dispatch:
types: ["Data: Generate build engine inventory"]
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
jobs:
update-image-info:
name: Update image info data
runs-on: super
if: ${{ github.repository_owner == 'Armbian' }}
steps:
- name: Fix workspace permissions
run: |
sudo chown -R "$(id -u):$(id -g)" "$GITHUB_WORKSPACE" || true
sudo chmod -R u+rwX "$GITHUB_WORKSPACE" || true
- name: Checkout armbian.github.io
uses: actions/checkout@v6
with:
repository: armbian/armbian.github.io
fetch-depth: 0
path: armbian.github.io
- name: Checkout build
uses: actions/checkout@v6
with:
repository: armbian/build
fetch-depth: 0
path: build
- name: "Produce inventory JSON"
run: |
cd build
./compile.sh inventory-boards
- 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
mv "${{ github.workspace }}/build/output/info/image-info.json" data/
git add data/image-info.json
if ! git diff --cached --quiet; then
git commit -m "Update image-info.json from build repository"
# 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: "Run Bigin update action"
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
event-type: "Web: Directory listing"