Merge pull request #360 from pixelit-project/main #404
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
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@v4 | |
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@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache PlatformIO 💾 | |
uses: actions/cache@v4 | |
with: | |
path: ~/.platformio | |
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | |
- name: Set up Python 🐍 | |
uses: actions/setup-python@v5 | |
- 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 }} | |
upload-fw-to-docs: | |
needs: build-fw | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
repository: "pixelit-project/PixelIt.Docs" | |
path: docs | |
- name: Download artifacts 💾 | |
uses: actions/download-artifact@v3 | |
with: | |
name: pixelit-firmware | |
path: artifacts | |
- name: Prepare binaries for web flasher 🚀 | |
run: | | |
mkdir -p upload | |
cp ./docs/src/.vuepress/public/pixelit_flasher/firmware/firmware_*.bin ./upload/ | |
cp -rf ./artifacts/*/firmware_*.bin ./upload/ | |
- name: Display structure of downloaded files 🔍 | |
run: ls -R ./upload/ | |
- name: Upload binaries to PixelIt.Docs for web flasher 🚀 | |
uses: cpina/github-action-push-to-another-repository@main | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} | |
with: | |
source-directory: "upload" | |
destination-github-username: "pixelit-project" | |
destination-repository-name: "PixelIt.Docs" | |
user-email: bot@pixelit | |
user-name: PixelIt Pipeline Bot | |
target-branch: master | |
target-directory: "src/.vuepress/public/pixelit_flasher/firmware/" | |
commit-message: Pushed binaries from main repo 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 |