workflow: Fix deploy path #6
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 Firmware and Upload .bin files to Hopping | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "ESPlant-Firmware/**" | |
- ".github/workflows/deploy.firmware.workflow.yml" | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "ESPlant-Firmware/**" | |
- ".github/workflows/deploy.firmware.workflow.yml" | |
jobs: | |
build-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install Dependencies | |
run: npm ci | |
working-directory: ESPlant-Firmware/frontend | |
- name: Build Frontend | |
run: npm run build | |
working-directory: ESPlant-Firmware/frontend | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: frontend | |
path: ESPlant-Firmware/main/index_html.c | |
build-firmware: | |
runs-on: ubuntu-latest | |
needs: build-frontend | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Download Frontend Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: frontend | |
path: ESPlant-Firmware/main | |
- name: Build Firmware | |
run: | | |
docker run --rm -v $PWD:/project -w /project/ESPlant-Firmware -u $UID -e HOME=/tmp espressif/idf idf.py build | |
- name: Rename ESPlant-Firmware to firmware | |
run: mv ESPlant-Firmware/build/ESPlant-Firmware.bin ESPlant-Firmware/build/firmware.bin | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: firmware | |
path: ESPlant-Firmware/build/firmware.bin | |
deploy-firmware: | |
runs-on: ubuntu-latest | |
needs: build-firmware | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Download Firmware Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: firmware | |
path: firmware | |
- name: Upload Firmware Artifact | |
uses: easingthemes/ssh-deploy@main | |
with: | |
SSH_PRIVATE_KEY: ${{ secrets.HOPPING_KEY }} | |
ARGS: "-rlgoDzvc -i" | |
SOURCE: "firmware" | |
REMOTE_HOST: ${{ secrets.HOPPING_HOST }} | |
REMOTE_USER: ${{ secrets.HOPPING_USER }} | |
TARGET: ${{ secrets.HOPPING_HOST_PATH }}/api/firmware |