Skip to content

Commit

Permalink
update workflow for update binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
gtxaspec committed Mar 25, 2024
1 parent 1d001cd commit 6043dce
Show file tree
Hide file tree
Showing 30 changed files with 49 additions and 161 deletions.
74 changes: 49 additions & 25 deletions .github/workflows/firmware.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,47 +137,71 @@ jobs:
run: |
BOARD=${{ matrix.thingino-version }} make pack_full
- name: Rename image for release
- name: Prepare update image
run: |
# Extract the defconfig name to form a pattern for the file name, change _ to -
DYNAMIC_PART=$(echo "${{ matrix.thingino-version }}")
PATTERN="thingino-${DYNAMIC_PART}-*.bin"
BOARD=${{ matrix.thingino-version }} make pack_update
# Find the binary file using the generated pattern
INGFW=$(find ${HOME}/output/${{ matrix.thingino-version }}*/images/ -name "${PATTERN}" | head -n 1)
echo "INGFW: $INGFW"
if [[ -n "${INGFW}" ]]; then
# Remove the numeric timestamp part from the filename
INGFW_BASENAME=$(echo "${INGFW}" | sed 's/-[0-9]\{12\}\.bin$/.bin/')
echo "INGFW_BASENAME: $INGFW_BASENAME"
mv "${INGFW}" "${INGFW_BASENAME}"
echo INGFW=${INGFW_BASENAME} >> ${GITHUB_ENV}
- name: Rename and set environment for firmware files
run: |
DYNAMIC_PART="${{ matrix.thingino-version }}"
PATTERN="thingino-${DYNAMIC_PART}-*.bin"
UPDATE_PATTERN="thingino-${DYNAMIC_PART}-*-update.bin"
FULL_FW=$(find ${HOME}/output/${DYNAMIC_PART}*/images/ -name "${PATTERN}" | grep -v -- '-update.bin' | head -n 1)
UPDATE_FW=$(find ${HOME}/output/${DYNAMIC_PART}*/images/ -name "${UPDATE_PATTERN}" | grep -- '-update.bin' | head -n 1)
echo "FULL_FW: $FULL_FW"
echo "UPDATE_FW: $UPDATE_FW"
if [[ -n "${FULL_FW}" && -n "${UPDATE_FW}" ]]; then
FULL_FW_BASENAME=$(basename "${FULL_FW}" | sed 's/-[0-9]\{12\}\.bin$/.bin/')
UPDATE_FW_BASENAME=$(basename "${UPDATE_FW}" | sed -E 's/-[0-9]{12}(-update)?\.bin$/-update.bin/')
mv "${FULL_FW}" "${HOME}/output/${DYNAMIC_PART}/images/${FULL_FW_BASENAME}"
mv "${UPDATE_FW}" "${HOME}/output/${DYNAMIC_PART}/images/${UPDATE_FW_BASENAME}"
echo "FULL_FW=${HOME}/output/${DYNAMIC_PART}/images/${FULL_FW_BASENAME}" >> ${GITHUB_ENV}
echo "UPDATE_FW=${HOME}/output/${DYNAMIC_PART}/images/${UPDATE_FW_BASENAME}" >> ${GITHUB_ENV}
else
echo "Matching .bin file not found."
echo "Matching .bin files not found."
exit 1
fi
- name: Upload firmware as artifact
- name: Upload full firmware as artifact
uses: actions/upload-artifact@v4
with:
name: thingino-${{ matrix.thingino-version }}
path: ${{ env.INGFW }}
name: thingino-${{ matrix.thingino-version }}-full-firmware
path: |
${{ env.FULL_FW }}
- name: Upload firmware
- name: Upload update firmware as artifact
uses: actions/upload-artifact@v4
with:
name: thingino-${{ matrix.thingino-version }}-update-firmware
path: |
${{ env.UPDATE_FW }}
- name: Upload full firmware to release
if: github.event_name != 'pull_request'
uses: softprops/action-gh-release@master
with:
tag_name: ${{ env.TAG_NAME }}
files: ${{ env.INGFW }}
files: |
${{ env.FULL_FW }}
- name: Send completion notification with binary
if: github.event_name != 'pull_request' && env.INGFW && env.TG_ENABLE== 'true'
- name: Upload update firmware to release
if: github.event_name != 'pull_request'
uses: softprops/action-gh-release@master
with:
tag_name: firmware_update
files: |
${{ env.UPDATE_FW }}
- name: Send completion notification with binaries
if: github.event_name != 'pull_request' && env.FULL_FW && env.UPDATE_FW && env.TG_ENABLE == 'true'
run: |
TG_MSG="Commit: [${GIT_HASH}](https://github.com/${GITHUB_REPOSITORY}/commit/${GIT_HASH})\nBranch: [${GIT_BRANCH}](https://github.com/${GITHUB_REPOSITORY}/tree/${GIT_BRANCH})\nTag: [${TAG_NAME}](https://github.com/${GITHUB_REPOSITORY}/releases/tag/${TAG_NAME})\nTime: ${TIME}\nJob: [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})\n\n"
TG_ICON="\xE2\x9C\x85 GitHub Actions"
TG_HEADER=$(echo -e ${TG_MSG}${TG_ICON})
HTTP=$(curl ${TG_OPTIONS} -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot${TG_TOKEN}/sendDocument -F parse_mode=MarkdownV2 -F chat_id=${TG_CHANNEL} -F caption="${TG_HEADER}" -F document=@${INGFW} -F disable_web_page_preview=true)
echo Telegram response: ${HTTP}
TG_HEADER=$(echo -e "${TG_MSG}${TG_ICON}")
HTTP_FULL=$(curl ${TG_OPTIONS} -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot${TG_TOKEN}/sendDocument -F parse_mode=MarkdownV2 -F chat_id=${TG_CHANNEL} -F caption="${TG_HEADER}Full Firmware" -F document=@${{ env.FULL_FW }} -F disable_web_page_preview=true)
HTTP_UPDATE=$(curl ${TG_OPTIONS} -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot${TG_TOKEN}/sendDocument -F parse_mode=MarkdownV2 -F chat_id=${TG_CHANNEL} -F caption="${TG_HEADER}Update Firmware" -F document=@${{ env.UPDATE_FW }} -F disable_web_page_preview=true)
echo "Telegram response Full Firmware: $HTTP_FULL"
echo "Telegram response Update Firmware: $HTTP_UPDATE"
- name: Send error notification
if: github.event_name != 'pull_request' && failure()
Expand Down Expand Up @@ -207,4 +231,4 @@ jobs:
TG_ICON="\xF0\x9F\x9A\xA9 GitHub Actions"
TG_HEADER=$(echo -e ${TG_MSG}${TG_ICON})
HTTP=$(curl ${TG_OPTIONS} -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot${TG_TOKEN}/sendMessage -F parse_mode=MarkdownV2 -F chat_id=${TG_CHANNEL} -F text="${TG_HEADER}" -F disable_web_page_preview=true)
echo Telegram response: ${HTTP}
echo Telegram response: ${HTTP}
5 changes: 0 additions & 5 deletions configs/t10_jxh42_mt7601_defconfig

This file was deleted.

3 changes: 0 additions & 3 deletions configs/t20l_sc2232_eth_defconfig

This file was deleted.

6 changes: 0 additions & 6 deletions configs/t20x_jxf22_rtl8189etv_defconfig

This file was deleted.

6 changes: 0 additions & 6 deletions configs/t20x_jxf22_rtl8189ftv_defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions configs/t20x_jxf23_rtl8189ftv_defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions configs/t21n_jxh62_mt7601u_defconfig

This file was deleted.

6 changes: 0 additions & 6 deletions configs/t21n_ov2735b_8188fu_defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions configs/t21n_ov2735b_mt7601u_defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions configs/t21n_sc2235_rtl8189ftv_defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions configs/t21z_sc2300_rtl8188ftv_defconfig

This file was deleted.

6 changes: 0 additions & 6 deletions configs/t23n_sc2336_atbm6012b_defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions configs/t30l_sc1235_rtl8189ftv_defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions configs/t31al_gc2053_atbm6031_defconfig

This file was deleted.

4 changes: 0 additions & 4 deletions configs/t31l_gc2083_eth_defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions configs/t31l_jxq03p_rtl8189ftv_defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions configs/t31l_sc2336_atbm6012b_defconfig

This file was deleted.

7 changes: 0 additions & 7 deletions configs/t31l_sc2336_atbm6031_defconfig

This file was deleted.

7 changes: 0 additions & 7 deletions configs/t31lc_sc2336_atbm6012b_defconfig

This file was deleted.

3 changes: 0 additions & 3 deletions configs/t31n_gc2053_eth_defconfig

This file was deleted.

3 changes: 0 additions & 3 deletions configs/t31n_gc2063_eth_defconfig

This file was deleted.

3 changes: 0 additions & 3 deletions configs/t31n_gc4653_eth_defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions configs/t31n_jxq03p_rtl8189ftv_defconfig

This file was deleted.

7 changes: 0 additions & 7 deletions configs/t31x_gc2053_atbm6031_defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions configs/t31x_gc2053_rtl8189ftv_defconfig

This file was deleted.

3 changes: 0 additions & 3 deletions configs/t31x_gc4023_eth_defconfig

This file was deleted.

3 changes: 0 additions & 3 deletions configs/t31x_gc4653_eth_defconfig

This file was deleted.

3 changes: 0 additions & 3 deletions configs/t31x_jxk04_eth_defconfig

This file was deleted.

5 changes: 0 additions & 5 deletions configs/t31x_sc4236_rtl8189ftv_defconfig

This file was deleted.

1 change: 0 additions & 1 deletion configs/t31zx_imx327_eth_defconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# FRAG: soc toolchain ccache brand rootfs kernel system target local
BR2_SOC_INGENIC_T31ZX=y
BR2_SENSOR_MODEL="imx327"
BR2_PACKAGE_USBNET=y

0 comments on commit 6043dce

Please sign in to comment.