diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml new file mode 100644 index 0000000..6b9e7ef --- /dev/null +++ b/.github/workflows/deployment.yml @@ -0,0 +1,43 @@ +name: Deploy LS Sensor on Environment + +on: + deployment: + +jobs: + deployment: + runs-on: [self-hosted, iot] + environment: Home + + steps: + + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Initialize Arduino CLI + run: | + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file config.yaml core update-index + + - name: Install required board core + run: | + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file config.yaml core install arduino:avr + + - name: Install custom Arduino libraries (Windows) + shell: powershell + run: | + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file config.yaml lib install MQTTESP8266 + + - name: Set configs (Windows) + shell: powershell + run: | + $env:CONFIG_H | Out-File -Encoding ascii config.h + env: + CONFIG_H: ${{ secrets.CONFIG_H }} + + - name: Compile Arduino project + run: | + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file config.yaml compile --fqbn arduino:avr:uno ./ --output-dir build + + - name: Upload firmware to Arduino + run: | + $port = "${{ github.event.deployment.payload.serial_port }}" + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file config.yaml upload --fqbn arduino:avr:uno --port $port --input-dir build