forked from arcbtc/bitcoinSwitch
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] release workflow and build (#24)
* [FEAT] release workflow and build * cleanup firmwarezip * add bins to release artifact
- Loading branch information
Showing
10 changed files
with
131 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
|
||
- name: update version in repo | ||
env: | ||
tag: ${{ github.ref_name }} | ||
run: | | ||
tmp=$(mktemp) | ||
jq --arg version "$version" '.versions |= [$version] + .' installer/versions.json > "$tmp" && mv "$tmp" installer/versions.json | ||
git config --global user.name 'Alan Bits' | ||
git config --global user.email '[email protected]' | ||
git commit -am "[CHORE] update version to $tag" | ||
git push | ||
git push --delete origin $tag | ||
git tag -fa $tag -m "update via workflow" | ||
git push --tags | ||
- name: Install Arduino CLI | ||
uses: arduino/setup-arduino-cli@v1 | ||
|
||
- name: build sketch with arduino cli | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
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 ./firmware.zip ./dist/$tag/manifest.json ./dist/$tag/bootloader.bin \ | ||
./dist/$tag/boot_app0.bin ./dist/$tag/bitcoinSwitch.ino.bin ./dist/$tag/bitcoinSwitch.ino.partitions.bin | ||
pages: | ||
needs: [ release ] | ||
uses: ./.github/workflows/static.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
git clone https://github.com/lnbits/lnbits.github.io mainpage | ||
cp -r ./mainpage/assets ./installer/main_assets | ||
rm -rf mainpage | ||
|
||
mkdir -p ./installer/firmware/esp32 | ||
|
||
for version in $(jq -r '.versions[]' ./installer/versions.json); do | ||
rm -f firmware.zip | ||
wget https://github.com/lnbits/bitcoinswitch/releases/download/$version/firmware.zip | ||
unzip firmware.zip -d ./installer/firmware/esp32 | ||
rm firmware.zip | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,6 @@ | ||
#!/bin/sh | ||
git clone https://github.com/lnbits/lnbits.github.io mainpage | ||
cp -r ./mainpage/assets ./installer/main_assets | ||
rm -rf mainpage | ||
|
||
mkdir -p ./installer/firmware/esp32 | ||
|
||
for version in $(jq -r '.versions[]' ./installer/versions.json); do | ||
mkdir -p ./installer/firmware/esp32/$version | ||
wget https://github.com/lnbits/bitcoinswitch/releases/download/$version/firmware.zip | ||
unzip firmware.zip -d ./installer/firmware/esp32 | ||
rm firmware.zip | ||
done | ||
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 lib install WebSockets ArduinoJson | ||
arduino-cli compile --build-path build --fqbn esp32:esp32:esp32 bitcoinSwitch/bitcoinSwitch.ino |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"name": "LNbits bitcoinSwitch", | ||
"version": "%version%", | ||
"funding_url": "https://github.com/lnbits/bitcoinSwitch", | ||
"new_install_prompt_erase": true, | ||
"builds": [ | ||
{ | ||
"chipFamily": "ESP32", | ||
"parts": [ | ||
{ | ||
"path": "firmware/esp32/%version%/bootloader.bin", | ||
"offset": 4096 | ||
}, | ||
{ | ||
"path": "firmware/esp32/%version%/bitcoinSwitch.ino.partitions.bin", | ||
"offset": 32768 | ||
}, | ||
{ | ||
"path": "firmware/esp32/%version%/boot_app0.bin", | ||
"offset": 57344 | ||
}, | ||
{ | ||
"path": "firmware/esp32/%version%/bitcoinSwitch.ino.bin", | ||
"offset": 65536 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
#!/bin/sh | ||
version=$1 | ||
tmp=$(mktemp) | ||
jq --arg version "$version" '.versions |= [$version] + .' installer/versions.json > "$tmp" && mv "$tmp" installer/versions.json | ||
tag=$1 | ||
|
||
rm -rf dist | ||
mkdir -p dist/$tag | ||
|
||
cp build/bitcoinSwitch.ino.bin dist/$tag | ||
cp build/bitcoinSwitch.ino.partitions.bin dist/$tag | ||
cp build/boot_app0.bin dist/$tag | ||
cp build/bootloader.bin dist/$tag | ||
|
||
cp build/manifest.template.json dist/$tag/manifest.json | ||
sed -i -e "s/%version%/$tag/g" dist/$tag/manifest.json | ||
|
||
zip firmware.zip dist |