-
Notifications
You must be signed in to change notification settings - Fork 266
41 lines (33 loc) · 1.24 KB
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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@v41
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