Skip to content

JHEF URL (#1180)

JHEF URL (#1180) #1

Workflow file for this run

name: CI - Upload config to API
on:
push:
branches:
- 'master'
jobs:
deploy:
name: Update Build API
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: files
uses: tj-actions/changed-files@v34
with:
files: |
configs/default/**
- if: steps.files.outputs.any_changed == 'true'
name: Upload configuration
env:
API_KEY: ${{secrets.API_KEY}}
URL: https://build.betaflight.com/api/config
run: |
for target_config in ${{ steps.files.outputs.all_changed_files }}; do
if [[ $target_config == *.config ]]; then
BOARD_NAME=$(sed -n 's/^ *board_name \([^#]\+\).*$/\1/p' ${target_config} | sed -e 's/[[:space:]]*$//')
STATUS_RECEIVED=$(curl -s --write-out "%{http_code}\n" -X POST -H "Content-Type: text/plain; charset=utf-8" -H "API_KEY: ${API_KEY}" --data-binary @${target_config} ${URL} --silent);
echo "${BOARD_NAME} --> ${STATUS_RECEIVED}"
if [ $STATUS_RECEIVED -ne "200" ]; then
echo "Configuration upload not successful (${BOARD_NAME}) for Unified Target configuration ${target_config}."
exit 1
fi
fi
done