Skip to content

Commit

Permalink
fixup workflows and build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Oct 31, 2023
1 parent eff91c2 commit f4b5dec
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 36 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/arduino.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
strategy:
matrix:
fqbn:
- esp32:esp32:esp32
- esp32:esp32:esp32s3
- esp32:esp32:esp32c3
- esp32:esp32:ttgo-lora32
# - esp32:esp32:esp32s3
# - esp32:esp32:esp32c3
# future bluetooth chips
#- esp32:esp32:esp32c2
#- esp32:esp32:esp32c6
Expand All @@ -26,12 +26,15 @@ jobs:
- name: esp32:esp32
source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
sketch-paths: |
- bitcoinSwitch
libraries: |
- name: WebSockets
- name: ArduinoJson
- snsd
cli-compile-flags: |
- --warnings="none"
libraries: |
- name: ArduinoJson
- name: QRCode
- name: TFT_eSPI
- name: uBitcoin
# - name: tiny-AES-c
- uses: actions/upload-artifact@v2
with:
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
tag: ${{ github.ref_name }}
run: |
tmp=$(mktemp)
jq --arg version $tag '.versions |= [$version] + .' installer/versions.json > "$tmp" && mv "$tmp" installer/versions.json
jq --arg version $tag '.versions |= [$version] + .' versions.json > "$tmp" && mv "$tmp" versions.json
git config --global user.name 'Alan Bits'
git config --global user.email '[email protected]'
git commit -am "[CHORE] update version to $tag"
Expand All @@ -43,16 +43,11 @@ jobs:
tag: ${{ github.ref_name }}
run: |
sh build.sh
sh release.sh $tag
- name: Create github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" --generate-notes ./dist/$tag/manifest.json ./dist/$tag/bootloader.bin \
./dist/$tag/boot_app0.bin ./dist/$tag/snsd.ino.bin ./dist/$tag/snsd.ino.partitions.bin
pages:
needs: [ release ]
uses: ./.github/workflows/static.yml
gh release create "$tag" --generate-notes ./build/snsd.ino.bootloader.bin \
./build/snsd.ino.bin ./build/snsd.ino.partitions.bin
14 changes: 11 additions & 3 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: copy main assets
run: sh build-webinstaller.sh
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: build webinstaller
run: |
sh build-webinstaller.sh
cd hardware-installer
npm install
npx vite build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "installer"
path: "hardware-installer/dist"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
38 changes: 22 additions & 16 deletions build-webinstaller.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
#!/bin/sh
git clone https://github.com/lnbits/lnbits.github.io mainpage
cp -r ./mainpage/assets ./installer/main_assets
rm -rf mainpage
PROJECT_NAME=snsd
RELEASE=https://github.com/lnbits/nostr-signing-device/releases/download
INSTALLER_REPO=https://github.com/lnbits/hardware-installer
INSTALLER_PATH=./hardware-installer/public/firmware

mkdir -p ./installer/firmware/esp32
git clone $INSTALLER_REPO

for version in $(jq -r '.versions[]' ./installer/versions.json); do
mkdir -p ./installer/firmware/esp32/$version
wget https://github.com/lnbits/nostr-signing-device/releases/download/$version/manifest.json
mv manifest.json ./installer/firmware/esp32/$version
wget https://github.com/lnbits/nostr-signing-device/releases/download/$version/bootloader.bin
mv bootloader.bin ./installer/firmware/esp32/$version
wget https://github.com/lnbits/nostr-signing-device/releases/download/$version/boot_app0.bin
mv boot_app0.bin ./installer/firmware/esp32/$version
wget https://github.com/lnbits/nostr-signing-device/releases/download/$version/snsd.ino.bin
mv snsd.ino.bin ./installer/firmware/esp32/$version
wget https://github.com/lnbits/nostr-signing-device/releases/download/$version/snsd.ino.partitions.bin
mv snsd.ino.partitions.bin ./installer/firmware/esp32/$version
cp README.md ./hardware-installer/public/README.md
cp versions.json ./hardware-installer/src/versions.json
cp config.js ./hardware-installer/src/config.js

sed -i "s/%title%/$PROJECT_NAME/g" ./hardware-installer/index.html

mkdir -p $INSTALLER_PATH
for device in $(jq -r '.devices[]' ./hardware-installer/src/versions.json); do
for version in $(jq -r '.versions[]' ./hardware-installer/src/versions.json); do
mkdir -p $INSTALLER_PATH/$device/$version
wget $RELEASE/$version/$PROJECT_NAME.ino.bin
wget $RELEASE/$version/$PROJECT_NAME.ino.partitions.bin
wget $RELEASE/$version/$PROJECT_NAME.ino.bootloader.bin
mv $PROJECT_NAME.ino.bin $INSTALLER_PATH/$device/$version
mv $PROJECT_NAME.ino.partitions.bin $INSTALLER_PATH/$device/$version
mv $PROJECT_NAME.ino.bootloader.bin $INSTALLER_PATH/$device/$version
done
done
3 changes: 1 addition & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/sh
command -v arduino-cli >/dev/null 2>&1 || { echo >&2 "arduino-cli not found. Aborting."; exit 1; }
arduino-cli config --additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json init
arduino-cli core update-index
arduino-cli core install esp32:esp32
arduino-cli upgrade
arduino-cli lib install ArduinoJson QRCode TFT_eSPI uBitcoin # tiny-AES-c
arduino-cli compile --build-path build --fqbn esp32:esp32:esp32 snsd/snsd.ino
arduino-cli compile --build-path build --fqbn esp32:esp32:ttgo-lora32 snsd
35 changes: 35 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
export const addressesAndFiles = [
{
address: "0x1000",
fileName: "snsd.ino.bootloader.bin",
},
{
address: "0x8000",
fileName: "snsd.ino.partitions.bin",
},
{
address: "0xE000",
fileName: "boot_app0.bin",
},
{
address: "0x10000",
fileName: "snsd.ino.bin",
},
];

export const configPath = "elements.json";

export const elements = [
{
name: "config_ssid",
value: "",
label: "WiFi SSID",
type: "text",
},
{
name: "config_password",
value: "",
label: "WiFi password",
type: "text",
}
];
9 changes: 9 additions & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "snsd",
"devices": [
"esp32"
],
"versions": [
"v0.0.0"
]
}

0 comments on commit f4b5dec

Please sign in to comment.