StikDebug/.github/workflows/updatesource.yml
2026-08-03 18:13:31 -06:00

72 lines
2.2 KiB
YAML

name: Update StikDebug Source
on:
push:
tags: ["[0-9]*"]
permissions:
actions: read
jobs:
update-source:
runs-on: ubuntu-latest
steps:
- name: Wait for IPA build
env:
GH_TOKEN: ${{ github.token }}
run: |
endpoint="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/actions/workflows/build_ipa.yml/runs?event=push&branch=$GITHUB_REF_NAME&head_sha=$GITHUB_SHA"
for _ in {1..120}; do
run=$(curl --fail --silent --show-error \
-H "Authorization: Bearer $GH_TOKEN" \
-H "Accept: application/vnd.github+json" \
"$endpoint" | jq '.workflow_runs[0] // empty')
status=$(jq -r '.status // empty' <<< "$run")
conclusion=$(jq -r '.conclusion // empty' <<< "$run")
if [ "$status" = "completed" ]; then
test "$conclusion" = "success"
exit 0
fi
sleep 30
done
echo "Timed out waiting for Build Debug IPA."
exit 1
- name: Checkout StikDebug
uses: actions/checkout@v6
with:
ref: main
token: ${{ secrets.WEBSITE_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Update StikDebug source
id: update_source
working-directory: Website
run: |
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
python updatesource.py index.json
git add index.json
if git diff --staged --quiet; then
echo "changes=false" >> $GITHUB_OUTPUT
echo "No changes detected in index.json"
else
git commit -m "Update StikDebug source for latest release"
git push origin main
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Create job summary
run: |
if [[ "${{ steps.update_source.outputs.changes }}" == "true" ]]; then
echo "## StikDebug source updated" >> $GITHUB_STEP_SUMMARY
echo "Website/index.json was updated and pushed." >> $GITHUB_STEP_SUMMARY
else
echo "## StikDebug source already current" >> $GITHUB_STEP_SUMMARY
echo "No change to Website/index.json was needed." >> $GITHUB_STEP_SUMMARY
fi