From 3e09a6cf35bb6d2b63a8b818f667d05dd020053e Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Wed, 17 Aug 2022 15:29:07 -0700 Subject: [PATCH] upload ini from firmware build (#4456) --- .github/workflows/build-firmware.yaml | 4 ++ .github/workflows/gen-configs.yaml | 4 -- firmware/tunerstudio/upload_ini.sh | 64 ++++++++++++++------------- 3 files changed, 38 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build-firmware.yaml b/.github/workflows/build-firmware.yaml index 82742f39e4..c5b17defbe 100644 --- a/.github/workflows/build-firmware.yaml +++ b/.github/workflows/build-firmware.yaml @@ -354,6 +354,10 @@ jobs: if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && env.skip != 'true' }} run: bash misc/jenkins/compile_other_versions/prepare_bundle.sh ${{matrix.build-target}} ${{matrix.ini-file}} + - name: Upload .ini files + working-directory: ./firmware/tunerstudio/generated + run: ../upload_ini.sh ${{matrix.ini-file}} ${{ secrets.RUSEFI_ONLINE_FTP_USER }} ${{ secrets.RUSEFI_ONLINE_FTP_PASS }} ${{ secrets.RUSEFI_FTP_SERVER }} + - name: Upload build elf if: ${{ github.event_name != 'push' || github.ref != 'refs/heads/master' && env.skip != 'true' }} uses: actions/upload-artifact@v3 diff --git a/.github/workflows/gen-configs.yaml b/.github/workflows/gen-configs.yaml index 7ed402a42b..30ffadbdb8 100644 --- a/.github/workflows/gen-configs.yaml +++ b/.github/workflows/gen-configs.yaml @@ -80,10 +80,6 @@ jobs: github_token: ${{ github.token }} branch: ${{ steps.extract_branch.outputs.branch }} - - name: Upload .ini files - working-directory: ./firmware/tunerstudio/generated - run: ../upload_ini.sh ${{ secrets.RUSEFI_ONLINE_FTP_USER }} ${{ secrets.RUSEFI_ONLINE_FTP_PASS }} ${{ secrets.RUSEFI_FTP_SERVER }} - - name: Print Compiler version # NOTE: on mac, this is actually symlink'd to clang, not gcc, but that's ok - we want to build on both working-directory: . diff --git a/firmware/tunerstudio/upload_ini.sh b/firmware/tunerstudio/upload_ini.sh index 912098c3da..4f34ab9283 100755 --- a/firmware/tunerstudio/upload_ini.sh +++ b/firmware/tunerstudio/upload_ini.sh @@ -1,10 +1,16 @@ #!/bin/bash -# user=$1 -# pass=$2 -# host=$3 +# file=$1 +# user=$2 +# pass=$3 +# host=$4 -if [ ! "$1" ] || [ ! "$2" ] || [ ! "$3" ]; then +if [ ! "$1" ]; then + echo "No file" + exit 1 +fi + +if [ ! "$2" ] || [ ! "$3" ] || [ ! "$4" ]; then echo "No Secrets" exit 0 fi @@ -13,37 +19,35 @@ pwd echo -e "\nUploading .ini files" ls -l . -for f in *.ini; do if [[ -f "$f" ]]; then - echo "Processing file $f:" - sig=$(grep "^ *signature *=" $f | cut -f2 -d "=") - if [ ! -z "$sig" -a "$sig" != " " ]; then - echo "* found signature: $sig" - if [[ "$sig" =~ rusEFI.*([0-9]{4})\.([0-9]{2})\.([0-9]{2})\.([a-zA-Z0-9_-]+)\.([0-9]+) ]]; then - year=${BASH_REMATCH[1]} - month=${BASH_REMATCH[2]} - day=${BASH_REMATCH[3]} - board=${BASH_REMATCH[4]} - hash=${BASH_REMATCH[5]} - path="$year/$month/$day/$board/$hash.ini" - echo "* found path: $path" - # we do not have ssh for this user - # sftp does not support -p flag on mkdir :( - sshpass -p $2 sftp -o StrictHostKeyChecking=no $1@$3 <