Skip to content

Commit d4459e0

Browse files
committed
Automate binary move and JSON creation
1 parent 10374c2 commit d4459e0

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

.github/workflows/compile-release.yml

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ on:
55
- main
66

77
env:
8-
FILENAME_PREFIX: RTK_Surveyor_Firmware_v3_0
8+
FILENAME_PREFIX: RTK_Surveyor_Firmware_
9+
VERSION: 3.1
910
POINTPERFECT_TOKEN: ${{ secrets.POINTPERFECT_TOKEN }}
1011

1112
jobs:
@@ -72,10 +73,36 @@ jobs:
7273
cd Firmware/RTK_Surveyor
7374
cd build
7475
cd esp32.esp32.esp32
75-
mv RTK_Surveyor.ino.bin ${{ env.FILENAME_PREFIX }}.bin
76+
mv RTK_Surveyor.ino.bin ${{ env.FILENAME_PREFIX }}${{ env.VERSION }}.bin
7677
77-
- name: Upload binary to action
78-
uses: actions/upload-artifact@v3
79-
with:
80-
name: ${{ env.FILENAME_PREFIX }}
81-
path: ./Firmware/RTK_Surveyor/build/esp32.esp32.esp32/${{ env.FILENAME_PREFIX }}.bin
78+
- name: Push binary to Binaries Repo
79+
uses: dmnemec/copy_file_to_another_repo_action@main
80+
env:
81+
API_TOKEN_GITHUB: ${{ secrets.API_GITHUB_RTK_FILE_TOKEN }}
82+
with:
83+
source_file: ./Firmware/RTK_Surveyor/build/esp32.esp32.esp32/${{ env.FILENAME_PREFIX }}${{ env.VERSION }}.bin
84+
destination_repo: 'sparkfun/SparkFun_RTK_Firmware_Binaries'
85+
destination_folder: ''
86+
user_email: '[email protected]'
87+
user_name: 'nseidle'
88+
commit_message: 'Github Action - Updating Binary ${{ steps.date.outputs.date }}'
89+
90+
- name: Update JSON File
91+
uses: "DamianReeves/write-file-action@master"
92+
with:
93+
path: RTK-Firmware.json
94+
write-mode: overwrite
95+
contents: |
96+
{"Configurations": [{"Version":"${{ env.VERSION }}", "URL":"https://raw.githubusercontent.com/sparkfun/SparkFun_RTK_Firmware_Binaries/main/${{ env.FILENAME_PREFIX }}${{ env.VERSION }}.bin"}]}
97+
98+
- name: Push JSON to Binaries Repo
99+
uses: dmnemec/copy_file_to_another_repo_action@main
100+
env:
101+
API_TOKEN_GITHUB: ${{ secrets.API_GITHUB_RTK_FILE_TOKEN }}
102+
with:
103+
source_file: RTK-Firmware.json
104+
destination_repo: 'sparkfun/SparkFun_RTK_Firmware_Binaries'
105+
destination_folder: ''
106+
user_email: '[email protected]'
107+
user_name: 'nseidle'
108+
commit_message: 'Github Action - Updating JSON ${{ steps.date.outputs.date }}'

0 commit comments

Comments
 (0)