Skip to content

Test webflasher upload #322

Test webflasher upload

Test webflasher upload #322

name: Build, Release & Deploy
on: [push]
env:
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'testing') }}
jobs:
build-webui:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
repository: "pixelit-project/WebUI"
- name: Use Node.js 💾
uses: actions/setup-node@v3
with:
node-version: 19.x
- name: Install dependencies 🔧
run: npm install
- name: Build WebUI 🏗️
run: npm run build
- name: Upload build artifacts 💾
uses: actions/upload-artifact@v3
with:
name: pixelit-webui
path: dist
build-fw:
needs: build-webui
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Cache pip 💾
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO 💾
uses: actions/cache@v3
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python 🐍
uses: actions/setup-python@v4
- name: Download WebUI artifacts 💾
uses: actions/download-artifact@v3
with:
name: pixelit-webui
path: pixelit-webui-artifact
- name: Update webinterface.h 🔧
run: |
python .github/webui.py
- name: Update version in PixelIt.ino 🔧
run: |
python .github/updateversion.py ${{ github.ref_name }}
- name: Install pio and its dependencies 🔧
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio esptool
- name: Run PlatformIO build on selected platforms 🏗️
run: platformio run -e ESP8266_generic -e ESP8266_nodemcuv2 -e ESP32_generic -e ESP32_d1_mini32 -e ESP8266_d1_mini -e ESP32_ulanzi
- name: Merge ESP32 firmware to single binaries 🔧
run: |
python .github/merge.py
- name: Upload build artifacts 💾
uses: actions/upload-artifact@v3
with:
name: pixelit-firmware
path: .pio/build/*/firmware_*.bin
release-fw:
needs: build-fw
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artifacts 💾
uses: actions/download-artifact@v3
with:
name: pixelit-firmware
- name: Display structure of downloaded files 🔍
run: ls -R
- name: Upload binaries as release 🚀
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./*/firmware_*.bin
tag: ${{ github.ref }}
release_name: ${{ github.ref_name }}
overwrite: true
file_glob: true
prerelease: ${{ env.prerelease }}
- name: Prepare binaries for web flasher 🚀
run: |
mkdir -p firmware
cp ./*/firmware_*.bin firmware/
- name: Upload binaries to PixelIt.Docs for web flasher 🚀
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.GITHUB_TOKEN }}
with:
source-directory: "firmware"
destination-github-username: "pixelit-project"
destination-repository-name: "PixelIt.Docs"
user-email: bot@pixelit
target-branch: master
target-directory: "src/.vuepress/public/pixelit_flasher/"
commit-message: pushed from $GITHUB_REF via GitHub Actions
# deploy-webui-gh-pages:
# runs-on: ubuntu-latest
# needs: build-webui
# if: startsWith(github.ref, 'refs/tags/')
# steps:
# - name: Checkout 🛎️
# uses: actions/checkout@v4
# with:
# repository: "pixelit-project/WebUI"
# - name: Download artifacts 💾
# uses: actions/download-artifact@v3
# with:
# name: pixelit-webui
# path: webui
# - name: Deploy 🚀
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# branch: gh-pages # The branch the action should deploy to.
# folder: . # The folder the action should deploy.
# clean: false # Automatically remove deleted files from the deploy branch