Automated updating to beta and nightly versions (#425)
* Github actions * Update firmware update and import/export * Auto commit fixes
This commit is contained in:
121
.github/workflows/beta.yml
vendored
Normal file
121
.github/workflows/beta.yml
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
name: NukiHub Beta
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build ${{ matrix.board }} (${{ matrix.build }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
board: [esp32dev, esp32-s3, esp32-c3, esp32-c6, esp32solo1]
|
||||
build: [release]
|
||||
env:
|
||||
BOARD: ${{ matrix.board }}
|
||||
VARIANT: ${{ matrix.name || matrix.board }}
|
||||
BUILD: ${{ matrix.build }}
|
||||
steps:
|
||||
- name: Fix variant name
|
||||
run: |
|
||||
# remove dash character
|
||||
export VARIANT=${VARIANT//-/}
|
||||
|
||||
if [ "$VARIANT" = "esp32dev" ]; then
|
||||
VARIANT="esp32"
|
||||
fi
|
||||
|
||||
echo "VARIANT=${VARIANT}" | tee -a ${GITHUB_ENV}
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/pip
|
||||
~/.platformio/.cache
|
||||
~/.platformio/packages
|
||||
key: ${{ runner.os }}-pio-${{ matrix.board }}
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.9'
|
||||
- name: Install dependencies
|
||||
run: make deps
|
||||
- name: Add version info
|
||||
env:
|
||||
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
|
||||
run: |
|
||||
sed -i "s/unknownbuildnr/$Version (${BUILD})/g" src/Config.h
|
||||
- name: Build ${{ matrix.build }} PlatformIO Project ${{ matrix.board }}
|
||||
run: |
|
||||
if [ "$BUILD" = "debug" ]; then
|
||||
BOARD="${BOARD}_dbg"
|
||||
fi
|
||||
echo "::group::Building with PlatformIO"
|
||||
if [ "$BUILD" = "release" ]; then
|
||||
make updater_${BOARD}
|
||||
fi
|
||||
make $BOARD
|
||||
echo "::endgroup::"
|
||||
- name: Add flash script
|
||||
env:
|
||||
DOC: resources/how-to-flash.txt
|
||||
FILES: ${{ format('{0}/{1}', env.BUILD, env.VARIANT) }}
|
||||
run: |
|
||||
BOARD=`echo $BOARD | tr '[:lower:]' '[:upper:]'`
|
||||
|
||||
# fix for docs
|
||||
if [ "$BOARD" = "ESP32DEV" ]; then
|
||||
BOARD="ESP32"
|
||||
fi
|
||||
|
||||
# look for documentation on flash and copy the command
|
||||
command=`sed -n '/^Howto flash (esptool)$/,$p' ${DOC} | sed -n '/^## '"${BOARD}"'$/,\${ n; n; p; }' | head -n1`
|
||||
|
||||
if [ -z "$command" ]; then
|
||||
echo "::error::Command not found in document ${DOC} for board ${BOARD}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "Command: "
|
||||
echo "$command" | tee ${FILES}/flash.sh
|
||||
chmod a+x ${FILES}/flash.sh
|
||||
|
||||
- name: Upload Artifact ${{ matrix.board }}-${{ matrix.build }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ format('{0}-{1}-assets', env.VARIANT, matrix.build) }}
|
||||
path: ${{ matrix.build }}/${{ env.VARIANT }}
|
||||
ota-beta:
|
||||
name: Create beta from latest master
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Git Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
- name: Download release assets
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: release
|
||||
pattern: '*-release-assets'
|
||||
- name: Copy binaries to ota/beta
|
||||
run: |
|
||||
mkdir -p ota/beta/
|
||||
cp -vf release/*/nuki_hub_*.bin ota/beta/
|
||||
rm -rf release
|
||||
- name: Commit binaries to master
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "Update beta binaries"
|
||||
file_pattern: 'ota/beta/*.bin'
|
||||
branch: master
|
||||
skip_dirty_check: true
|
||||
skip_fetch: true
|
||||
skip_checkout: true
|
||||
disable_globbing: true
|
||||
add_options: '-f'
|
||||
14
.github/workflows/build.yml
vendored
14
.github/workflows/build.yml
vendored
@@ -6,7 +6,6 @@ on:
|
||||
pull_request:
|
||||
branches: ["*"]
|
||||
tags: ["*"]
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
@@ -96,7 +95,6 @@ jobs:
|
||||
with:
|
||||
name: ${{ format('{0}-{1}-assets', env.VARIANT, matrix.build) }}
|
||||
path: ${{ matrix.build }}/${{ env.VARIANT }}
|
||||
|
||||
release:
|
||||
name: Release new version
|
||||
needs: build
|
||||
@@ -109,7 +107,7 @@ jobs:
|
||||
- name: Git Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
ref: ${{ github.head_ref }}
|
||||
- name: Download release assets
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
@@ -168,16 +166,22 @@ jobs:
|
||||
name: "Nuki Hub ${{ steps.get_version.outputs.VERSION }}"
|
||||
artifacts: ${{ steps.zip.outputs.artifacts }}
|
||||
artifactContentType: application/zip
|
||||
- name: Copy binaries to ota and webflash
|
||||
- name: Copy binaries to ota and webflash and remove beta
|
||||
run: |
|
||||
cp -vf release/*/nuki_hub_*.bin ota/
|
||||
cp -vf release/*/webflash_nuki_hub_*.bin webflash/
|
||||
rm -rf release
|
||||
rm -rf debug
|
||||
rm -rf NukiHub-*.zip
|
||||
git rm -r --cached ota/beta/*.bin
|
||||
- name: Commit binaries to master
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "Update binaries for version ${{ steps.get_version.outputs.VERSION }}"
|
||||
file_pattern: 'ota/*.bin webflash/*.bin'
|
||||
file_pattern: 'ota/*.bin ota/beta/*.bin ota/beta/debug/*.bin webflash/*.bin'
|
||||
branch: master
|
||||
skip_dirty_check: true
|
||||
skip_fetch: true
|
||||
skip_checkout: true
|
||||
disable_globbing: true
|
||||
add_options: '-f'
|
||||
127
.github/workflows/nightly.yml
vendored
Normal file
127
.github/workflows/nightly.yml
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
name: NukiHub Nightly
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "30 0 * * *"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build ${{ matrix.board }} (${{ matrix.build }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
board: [esp32dev, esp32-s3, esp32-c3, esp32-c6, esp32solo1]
|
||||
build: [release]
|
||||
env:
|
||||
BOARD: ${{ matrix.board }}
|
||||
VARIANT: ${{ matrix.name || matrix.board }}
|
||||
BUILD: ${{ matrix.build }}
|
||||
steps:
|
||||
- name: Fix variant name
|
||||
run: |
|
||||
# remove dash character
|
||||
export VARIANT=${VARIANT//-/}
|
||||
|
||||
if [ "$VARIANT" = "esp32dev" ]; then
|
||||
VARIANT="esp32"
|
||||
fi
|
||||
|
||||
echo "VARIANT=${VARIANT}" | tee -a ${GITHUB_ENV}
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Get new commits
|
||||
run: echo "NEW_COMMIT_COUNT=$(git log --oneline --since '24 hours ago' | wc -l)" >> $GITHUB_ENV
|
||||
- uses: actions/cache@v4
|
||||
if: ${{ env.NEW_COMMIT_COUNT > 1 }}
|
||||
with:
|
||||
path: |
|
||||
~/.cache/pip
|
||||
~/.platformio/.cache
|
||||
~/.platformio/packages
|
||||
key: ${{ runner.os }}-pio-${{ matrix.board }}
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.9'
|
||||
- name: Install dependencies
|
||||
run: make deps
|
||||
- name: Add version info
|
||||
env:
|
||||
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
|
||||
run: |
|
||||
sed -i "s/unknownbuildnr/$Version (${BUILD})/g" src/Config.h
|
||||
- name: Build ${{ matrix.build }} PlatformIO Project ${{ matrix.board }}
|
||||
run: |
|
||||
if [ "$BUILD" = "debug" ]; then
|
||||
BOARD="${BOARD}_dbg"
|
||||
fi
|
||||
echo "::group::Building with PlatformIO"
|
||||
if [ "$BUILD" = "release" ]; then
|
||||
make updater_${BOARD}
|
||||
fi
|
||||
make $BOARD
|
||||
echo "::endgroup::"
|
||||
- name: Add flash script
|
||||
env:
|
||||
DOC: resources/how-to-flash.txt
|
||||
FILES: ${{ format('{0}/{1}', env.BUILD, env.VARIANT) }}
|
||||
run: |
|
||||
BOARD=`echo $BOARD | tr '[:lower:]' '[:upper:]'`
|
||||
|
||||
# fix for docs
|
||||
if [ "$BOARD" = "ESP32DEV" ]; then
|
||||
BOARD="ESP32"
|
||||
fi
|
||||
|
||||
# look for documentation on flash and copy the command
|
||||
command=`sed -n '/^Howto flash (esptool)$/,$p' ${DOC} | sed -n '/^## '"${BOARD}"'$/,\${ n; n; p; }' | head -n1`
|
||||
|
||||
if [ -z "$command" ]; then
|
||||
echo "::error::Command not found in document ${DOC} for board ${BOARD}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "Command: "
|
||||
echo "$command" | tee ${FILES}/flash.sh
|
||||
chmod a+x ${FILES}/flash.sh
|
||||
|
||||
- name: Upload Artifact ${{ matrix.board }}-${{ matrix.build }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ format('{0}-{1}-assets', env.VARIANT, matrix.build) }}
|
||||
path: ${{ matrix.build }}/${{ env.VARIANT }}
|
||||
ota-nightly:
|
||||
name: Create nightly from latest master
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Git Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
- name: Download release assets
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: release
|
||||
pattern: '*-release-assets'
|
||||
- name: Copy binaries to ota/master
|
||||
run: |
|
||||
mkdir -p ota/master/
|
||||
cp -vf release/*/nuki_hub_*.bin ota/master/
|
||||
rm -rf release
|
||||
- name: Commit binaries to master
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "Update master binaries"
|
||||
file_pattern: 'ota/master/*.bin'
|
||||
branch: master
|
||||
skip_dirty_check: true
|
||||
skip_fetch: true
|
||||
skip_checkout: true
|
||||
disable_globbing: true
|
||||
add_options: '-f'
|
||||
Reference in New Issue
Block a user