Compile and publish runtimes for online previews #6
This file contains hidden or 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: Compile and publish runtimes for online previews | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Define branch name' | |
required: true | |
default: 'master' | |
subfolder: | |
description: 'Define subfolder name' | |
required: true | |
default: '.' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout repository (with submodules) | |
- name: Checkout repository (with submodules) | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.branch }} | |
submodules: recursive | |
fetch-depth: 1 | |
- name: Get the previews branch | |
run: | | |
git fetch origin | |
git branch lvgl-previews remotes/origin/lvgl-previews | |
- name: Configure Git | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: Download the LVGL CLI tool | |
run: | | |
# download the LVGL CLI tool | |
curl -OL https://github.com/lvgl/lvgl_editor/releases/download/v.0.3.0/LVGL_CLI-0.3.0-linux-mac.zip | |
# unzip the downloaded file | |
unzip LVGL_CLI-0.3.0-linux-mac.zip | |
# run it to show the version | |
./lved-cli.js -V | |
- name: Compile the preview runtime | |
run: | | |
# compile the project | |
./lved-cli.js compile ${{ github.event.inputs.subfolder }} | |
- name: Commit the runtime to branch 'lvgl-previews' and push | |
run: | | |
cd ${{ github.event.inputs.subfolder }} | |
git worktree add -f ~/runtimes-branch lvgl-previews | |
CURRENT_BRANCH=$(git branch --show-current) | |
DEST=~/runtimes-branch/branches/${CURRENT_BRANCH}/${{ github.event.inputs.subfolder }} | |
mkdir -p ${DEST} | |
cp runtime/lved-runtime.js ${DEST}/lved-runtime.js | |
cd ${DEST} | |
git add lved-runtime.js | |
git status | |
echo Committing changes... | |
git add . | |
git commit -m "Automated commit by ${{ github.actor }}" | |
echo Pushing changes to the 'lvgl-previews' branch... | |
git push origin lvgl-previews |