Releasing 4.5.0-RC4 (#18) #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI - Upload Release index.json to API | |
on: | |
push: | |
branches: | |
- 'master' | |
paths: | |
- 'api-settings/releases/**' | |
jobs: | |
deploy: | |
name: Create or Update Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- id: files | |
uses: tj-actions/changed-files@v34 | |
with: | |
files: | | |
api-settings/releases/** | |
- if: steps.files.outputs.any_changed == 'true' | |
name: Upload release configuration | |
env: | |
API_KEY: ${{secrets.API_KEY}} | |
URL: https://build.betaflight.com/api/releases | |
run: | | |
for release in ${{ steps.files.outputs.all_changed_files }}; do | |
if [[ $release == */index.json ]]; then | |
STATUS_RECEIVED=$(curl -s --write-out "%{http_code}\n" -X POST -H "Content-Type: application/json; charset=utf-8" -H "API_KEY: ${API_KEY}" --data-binary @${release} ${URL} --silent); | |
echo "${release} --> ${STATUS_RECEIVED}" | |
if [ $STATUS_RECEIVED -ne "200" ]; then | |
echo "Release config upload not successful ${release}." | |
exit 1 | |
fi | |
fi | |
done |