1+ name : Build RTK Firmware
2+ on :
3+ workflow_dispatch :
4+ branches :
5+
6+ env :
7+ FILENAME_PREFIX : RTK_Surveyor_Firmware
8+ FIRMWARE_VERSION_MAJOR : 3
9+ FIRMWARE_VERSION_MINOR : 2
10+ POINTPERFECT_TOKEN : ${{ secrets.POINTPERFECT_TOKEN }}
11+
12+ jobs :
13+ build :
14+
15+ name : Build
16+ runs-on : ubuntu-latest
17+
18+ steps :
19+ - name : Checkout
20+ uses : actions/checkout@master
21+
22+ - name : Setup Arduino CLI
23+ uses : arduino/setup-arduino-cli@v1
24+
25+ - name : Start config file
26+ run : arduino-cli config init --additional-urls "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json"
27+
28+ - name : Update index
29+ run : arduino-cli core update-index
30+
31+ # We limit the ESP32 core to v2.0.2
32+ - name : Install platform
33+ run :
arduino-cli core install esp32:[email protected] 34+
35+ - name : Get Known Libraries
36+ run : arduino-cli lib install
37+ 38+ 39+ 40+ 41+ 42+ 43+
44+ - name : Enable external libs
45+ run : arduino-cli config set library.enable_unsafe_install true
46+
47+ - name : Get Libraries
48+ run : arduino-cli lib install --git-url
49+ https://github.com/sparkfun/SparkFun_u-blox_GNSS_v3.git
50+ https://github.com/sparkfun/SparkFun_MAX1704x_Fuel_Gauge_Arduino_Library.git
51+ https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library.git
52+ https://github.com/sparkfun/SparkFun_LIS2DH12_Arduino_Library.git
53+ https://github.com/nseidle/ESP32-OTA-Pull.git
54+ https://github.com/me-no-dev/ESPAsyncWebServer.git
55+ https://github.com/me-no-dev/AsyncTCP.git
56+
57+ # Incorporate ESP-Now patch into core: https://github.com/espressif/arduino-esp32/pull/7044/files
58+ # - name: Patch ESP32 Core
59+ # run: |
60+ # cd Firmware/RTK_Surveyor/Patch/
61+ # cp WiFiGeneric.cpp /home/runner/.arduino15/packages/esp32/hardware/esp32/2.0.2/libraries/WiFi/src/WiFiGeneric.cpp
62+
63+ - name : Compile Sketch
64+ run : arduino-cli compile --fqbn esp32:esp32:esp32 ./Firmware/RTK_Surveyor/RTK_Surveyor.ino
65+ --build-property build.partitions=partitions
66+ --build-property upload.maximum_size=3145728
67+ --build-property "compiler.cpp.extra_flags=\"-DPOINTPERFECT_TOKEN=$POINTPERFECT_TOKEN\" \"-DFIRMWARE_VERSION_MAJOR=$FIRMWARE_VERSION_MAJOR\" \"-DFIRMWARE_VERSION_MINOR=$FIRMWARE_VERSION_MINOR\""
68+ --export-binaries
69+
70+ - name : Get current date
71+ id : date
72+ run : echo "date=$(date +'%b_%d_%Y')" >> $GITHUB_OUTPUT
73+
74+ - name : Get current date
75+ id : dateNoScores
76+ run : echo "dateNoScores=$(date +'%b %d %Y')" >> $GITHUB_OUTPUT
77+
78+ - name : Extract branch name
79+ run : echo "BRANCH=${{github.ref_name}}" >> $GITHUB_ENV
80+
81+ # File_Name_v3_1.bin
82+ # File_Name_RC-Jan_26_2023.bin
83+ - name : Create file ending based on branch
84+ run : |
85+ if [[ $BRANCH == 'main' ]]; then
86+ echo "FILE_ENDING_UNDERSCORE=_v${{ env.FIRMWARE_VERSION_MAJOR }}_${{ env.FIRMWARE_VERSION_MINOR }}" >> "$GITHUB_ENV"
87+ echo "FILE_ENDING_NOUNDERSCORE=_v${{ env.FIRMWARE_VERSION_MAJOR }}.${{ env.FIRMWARE_VERSION_MINOR }}" >> "$GITHUB_ENV"
88+ else
89+ echo "FILE_ENDING_UNDERSCORE=_RC-${{ steps.date.outputs.date }}" >> "$GITHUB_ENV"
90+ echo "FILE_ENDING_NOUNDERSCORE=_RC-${{ steps.dateNoScores.outputs.dateNoScores }}" >> "$GITHUB_ENV"
91+ fi
92+
93+ - name : Rename binary
94+ run : |
95+ cd Firmware/RTK_Surveyor/build/esp32.esp32.esp32/
96+ mv RTK_Surveyor.ino.bin ${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
97+
98+ - name : Upload binary to action
99+ uses : actions/upload-artifact@v3
100+ with :
101+ name : ${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}
102+ path : ./Firmware/RTK_Surveyor/build/esp32.esp32.esp32/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
103+
104+ - name : Push binary to Binaries Repo
105+ uses : dmnemec/copy_file_to_another_repo_action@main
106+ env :
107+ API_TOKEN_GITHUB : ${{ secrets.API_GITHUB_RTK_FILE_TOKEN }}
108+ with :
109+ source_file : ./Firmware/RTK_Surveyor/build/esp32.esp32.esp32/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin
110+ destination_repo : ' sparkfun/SparkFun_RTK_Firmware_Binaries'
111+ destination_folder : ' '
112+ 113+ user_name : ' nseidle'
114+ commit_message : ' Github Action - Updating Binary ${{ steps.dateNoScores.outputs.dateNoScores }}'
115+
116+ - name : Update JSON File
117+ uses : " DamianReeves/write-file-action@master"
118+ with :
119+ path : RTK-Firmware.json
120+ write-mode : overwrite
121+ contents : |
122+ {"Configurations": [{"Version":"${{ env.FILE_ENDING_NOUNDERSCORE }}", "URL":"https://raw.githubusercontent.com/sparkfun/SparkFun_RTK_Firmware_Binaries/main/${{ env.FILENAME_PREFIX }}${{ env.FILE_ENDING_UNDERSCORE }}.bin"}]}
123+
124+ - name : Push JSON to Binaries Repo
125+ uses : dmnemec/copy_file_to_another_repo_action@main
126+ env :
127+ API_TOKEN_GITHUB : ${{ secrets.API_GITHUB_RTK_FILE_TOKEN }}
128+ with :
129+ source_file : RTK-Firmware.json
130+ destination_repo : ' sparkfun/SparkFun_RTK_Firmware_Binaries'
131+ destination_folder : ' '
132+ 133+ user_name : ' nseidle'
134+ commit_message : ' Github Action - Updating JSON ${{ steps.dateNoScores.outputs.dateNoScores }}'
0 commit comments