Skip to content

Commit

Permalink
Merge pull request #61 from adafruit/add-action
Browse files Browse the repository at this point in the history
add gh action
  • Loading branch information
hathach authored Dec 13, 2023
2 parents dffbd44 + a399c40 commit 42f4766
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 5 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build

on:
repository_dispatch:
push:
pull_request:
branches: [ master ]
release:
types:
- created

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Pull ESP-IDF docker
run: docker pull espressif/idf:v3.3.1

- name: Checkout
uses: actions/checkout@v3

- name: Build
run: docker run --rm -v $PWD:/project -w /project espressif/idf:v3.3.1 make firmware

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: NINA_W102-${{ github.sha }}
path: |
NINA_W102*.bin
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'release' }}
with:
files: |
NINA_W102*.bin
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ load-passthrough:
cp passthrough.UF2 $(BOOT_VOLUME)

load-nina:
esptool.py --port $(M4_PORT) --before no_reset --baud $(UPLOAD_BAUD) write_flash 0 NINA_W102-1.7.6.bin
esptool.py --port $(M4_PORT) --before no_reset --baud $(UPLOAD_BAUD) write_flash 0 $(wildcard NINA_W102-*.bin)

load-circuitpython:
cp $(CIRCUITPYTHON_UF2) $(BOOT_VOLUME)
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ Contributors who follow the [Code of Conduct](https://github.com/adafruit/nina-f
are welcome to submit pull requests and they will be promptly
reviewed by project admins. Please join the [Discord](https://adafru.it/discord) too.

The NINA firmware version needs to be updated in four places in this repo:
The NINA firmware version needs to be updated in two places in this repo:
1. CommandHandler.cpp
1. combine.py
1. Makefile
1. CHANGELOG

## Building
Expand Down
15 changes: 14 additions & 1 deletion combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

import sys;


def extract_firmware_version():
with open('main/CommandHandler.cpp', 'r') as file:
for line in file:
if 'const char FIRMWARE_VERSION[6] = ' in line:
# The line format is `const char FIRMWARE_VERSION[6] = "1.7.6";`
# Split by double quote and get the second element
version = line.split('"')[1]
return version


booloaderData = open("build/bootloader/bootloader.bin", "rb").read()
partitionData = open("build/partitions.bin", "rb").read()
appData = open("build/nina-fw.bin", "rb").read()
Expand Down Expand Up @@ -31,7 +42,9 @@
# zero terminate the pem file
outputData[0x10000 + len(certsData)] = 0

outputFilename = "NINA_W102-1.7.6.bin"
version = extract_firmware_version()
outputFilename = f"NINA_W102-{version}.bin"

if (len(sys.argv) > 1):
outputFilename = sys.argv[1]

Expand Down

0 comments on commit 42f4766

Please sign in to comment.