CONFIG: define BMI270 for ATOMRCF405 (#12536)
[betaflight.git] / .github / workflows / target-creation.yml
blob459dce409058c79d810a2c28583f1d332d0f87ea
1 name: CI - Upload config.h to API
3 on:
4   push:
5     branches:
6       - 'master'
7     paths:
8       - 'src/config/**'
10 jobs:
11   deploy:
12     name: Create or Update Target
13     runs-on: ubuntu-latest
15     steps:
16     - uses: actions/checkout@v3
18     - id: files
19       uses: tj-actions/changed-files@v34
20       with:
21         files: |
22           src/config/**
24     - if: steps.files.outputs.any_changed == 'true'
25       name: Upload configuration
26       env:
27         API_KEY: ${{secrets.API_KEY}}
28         URL: https://build.betaflight.com/api/config
29       run: |
30         for target_config in ${{ steps.files.outputs.all_changed_files }}; do
32             if [[ $target_config == */config.h ]]; then
33               BOARD_NAME=$(sed -n 's/^.*[[:space:]]BOARD_NAME \([^#]\+\).*$/\1/p' ${target_config} | sed -e 's/[[:space:]]*$//')
34               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);
35               echo "${BOARD_NAME}  -->  ${STATUS_RECEIVED}"
37               if [ $STATUS_RECEIVED -ne "200" ]; then
38                   echo "Configuration upload not successful (${BOARD_NAME}) for Target configuration ${target_config}."
39                   exit 1
40               fi
41             fi
43         done