Skip to content

Update RPi Imager JSON #52

Update RPi Imager JSON

Update RPi Imager JSON #52

name: Update RPi Imager JSON
on:
workflow_run:
workflows: ["Create Release"]
types: [completed]
branches: [main]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
jobs:
update-json:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq curl unzip
- name: Update RPi Imager JSON
run: |
chmod +x ./scripts/rpi-imager/update.sh
./scripts/rpi-imager/update.sh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit updated JSON
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add rpi-imager.json
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "Update rpi-imager.json for release ${{ github.event.release.tag_name }}"
git push
fi
deploy-pages:
needs: update-json
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Create Pages directory
run: |
mkdir -p _site
cp rpi-imager.json _site/
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: '_site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4