From 140a7e1841572dd128e0476bf8b1c3930ea7cccd Mon Sep 17 00:00:00 2001 From: Zefek Date: Tue, 9 Dec 2025 18:28:00 +0100 Subject: [PATCH 01/11] deployment --- .github/workflows/deployment.yml | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/deployment.yml diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml new file mode 100644 index 0000000..80f51cc --- /dev/null +++ b/.github/workflows/deployment.yml @@ -0,0 +1,65 @@ +name: Deploy LS Sensor on Environment + +on: + deployment: + +jobs: + deployment: + runs-on: self-hosted + environment: Home + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install Arduino CLI (Windows) + shell: powershell + run: | + $url = "https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_64bit.zip" + $out = "$RUNNER_TOOL_CACHE\arduino-cli.zip" + Invoke-WebRequest -Uri $url -OutFile $out + + $target = "$RUNNER_TOOL_CACHE\arduino-cli" + Expand-Archive -Path $out -DestinationPath $target -Force + + # Přidat do PATH jen pro tento job + $env:PATH = "$target;$env:PATH" + + # Volitelně: otestovat + $RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe version + + - name: Initialize Arduino CLI + run: | + $RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe config init + $RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe core update-index + + - name: Install required board core + run: $RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe core install arduino:avr + + - name: Install custom Arduino libraries (Windows) + shell: powershell + run: | + $arduinoLib = "$env:USERPROFILE\Documents\Arduino\libraries" + if (Test-Path "$arduinoLib\MQTTESP8266") { + Remove-Item -Recurse -Force "$arduinoLib\MQTTESP8266" + } + New-Item -ItemType Directory -Force -Path $arduinoLib + git clone https://github.com/Zefek/MQTTESP8266.git "$arduinoLib\MQTTESP8266" + + - name: Set configs (Windows) + shell: powershell + run: | + $env:CONFIG_H | Out-File -Encoding ascii config.h + $env:SENSORSCONFIG_H | Out-File -Encoding ascii sensorsconfig.h + env: + CONFIG_H: ${{ secrets.CONFIG_H }} + SENSORSCONFIG_H: ${{ secrets.SENSORSCONFIG_H }} + + - name: Compile Arduino project + run: | + $RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe compile --fqbn arduino:avr:uno ./ --output-dir build + + - name: Upload firmware to Arduino + run: | + $port = "${{ github.event.deployment.payload.serial_port }}" + $RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe upload --fqbn arduino:avr:uno --port $port --input-dir build From 2b96d414c0e4adde746305955df63ae272712d8a Mon Sep 17 00:00:00 2001 From: Zefek Date: Tue, 9 Dec 2025 18:47:20 +0100 Subject: [PATCH 02/11] variables --- .github/workflows/deployment.yml | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 80f51cc..a76e2b2 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -9,6 +9,35 @@ jobs: environment: Home steps: + - name: Show basic GitHub context + run: | + echo "Repository: ${{ github.repository }}" + echo "Ref: ${{ github.ref }}" + echo "Actor: ${{ github.actor }}" + + - name: Show runner environment variables (Linux/macOS) + if: runner.os != 'Windows' + run: | + echo "RUNNER_TOOL_CACHE: $RUNNER_TOOL_CACHE" + echo "RUNNER_TEMP: $RUNNER_TEMP" + echo "HOME: $HOME" + echo "PATH: $PATH" + + - name: Show runner environment variables (Windows) + if: runner.os == 'Windows' + run: | + echo "RUNNER_TOOL_CACHE: $Env:RUNNER_TOOL_CACHE" + echo "RUNNER_TEMP: $Env:RUNNER_TEMP" + echo "USERPROFILE: $Env:USERPROFILE" + echo "PATH: $Env:PATH" + + - name: List all environment variables (Linux/macOS) + if: runner.os != 'Windows' + run: printenv + + - name: List all environment variables (Windows) + if: runner.os == 'Windows' + run: set - name: Checkout repository uses: actions/checkout@v3 @@ -50,10 +79,8 @@ jobs: shell: powershell run: | $env:CONFIG_H | Out-File -Encoding ascii config.h - $env:SENSORSCONFIG_H | Out-File -Encoding ascii sensorsconfig.h env: CONFIG_H: ${{ secrets.CONFIG_H }} - SENSORSCONFIG_H: ${{ secrets.SENSORSCONFIG_H }} - name: Compile Arduino project run: | From e2bb1adcad694b8cd7dcb9b371d35baa8e469bf2 Mon Sep 17 00:00:00 2001 From: Zefek Date: Tue, 9 Dec 2025 18:49:20 +0100 Subject: [PATCH 03/11] env --- .github/workflows/deployment.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index a76e2b2..379576b 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -45,25 +45,25 @@ jobs: shell: powershell run: | $url = "https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_64bit.zip" - $out = "$RUNNER_TOOL_CACHE\arduino-cli.zip" + $out = "$Env:RUNNER_TOOL_CACHE\arduino-cli.zip" Invoke-WebRequest -Uri $url -OutFile $out - $target = "$RUNNER_TOOL_CACHE\arduino-cli" + $target = "$Env:RUNNER_TOOL_CACHE\arduino-cli" Expand-Archive -Path $out -DestinationPath $target -Force # Přidat do PATH jen pro tento job $env:PATH = "$target;$env:PATH" # Volitelně: otestovat - $RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe version + $Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe version - name: Initialize Arduino CLI run: | - $RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe config init - $RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe core update-index + $Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe config init + $Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe core update-index - name: Install required board core - run: $RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe core install arduino:avr + run: $Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe core install arduino:avr - name: Install custom Arduino libraries (Windows) shell: powershell @@ -84,9 +84,9 @@ jobs: - name: Compile Arduino project run: | - $RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe compile --fqbn arduino:avr:uno ./ --output-dir build + $Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe compile --fqbn arduino:avr:uno ./ --output-dir build - name: Upload firmware to Arduino run: | $port = "${{ github.event.deployment.payload.serial_port }}" - $RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe upload --fqbn arduino:avr:uno --port $port --input-dir build + $Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe upload --fqbn arduino:avr:uno --port $port --input-dir build From 218c53c7d1ecb385c638355ea448184fe14de03a Mon Sep 17 00:00:00 2001 From: Zefek Date: Tue, 9 Dec 2025 18:51:52 +0100 Subject: [PATCH 04/11] variables remove --- .github/workflows/deployment.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 379576b..7522a3d 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -35,9 +35,6 @@ jobs: if: runner.os != 'Windows' run: printenv - - name: List all environment variables (Windows) - if: runner.os == 'Windows' - run: set - name: Checkout repository uses: actions/checkout@v3 From 86b4b145a479c82494a24cd88afef4fcd92f9b39 Mon Sep 17 00:00:00 2001 From: Zefek Date: Tue, 9 Dec 2025 18:54:19 +0100 Subject: [PATCH 05/11] =?UTF-8?q?zkus=C3=ADme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 7522a3d..425e1ef 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -52,7 +52,7 @@ jobs: $env:PATH = "$target;$env:PATH" # Volitelně: otestovat - $Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe version + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" version - name: Initialize Arduino CLI run: | From 6db34a4600c4f6e96f972198f6f1149ccd68d5d9 Mon Sep 17 00:00:00 2001 From: Zefek Date: Tue, 9 Dec 2025 18:57:39 +0100 Subject: [PATCH 06/11] =?UTF-8?q?zkou=C5=A1ka?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deployment.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 425e1ef..015e4af 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -56,11 +56,12 @@ jobs: - name: Initialize Arduino CLI run: | - $Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe config init - $Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe core update-index + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" config init + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" core update-index - name: Install required board core - run: $Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe core install arduino:avr + run: | + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" core install arduino:avr - name: Install custom Arduino libraries (Windows) shell: powershell @@ -81,9 +82,9 @@ jobs: - name: Compile Arduino project run: | - $Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe compile --fqbn arduino:avr:uno ./ --output-dir build + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" 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 upload --fqbn arduino:avr:uno --port $port --input-dir build + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" upload --fqbn arduino:avr:uno --port $port --input-dir build From 073d78da7d73bcec61c838d005c94370453f2604 Mon Sep 17 00:00:00 2001 From: Zefek Date: Tue, 9 Dec 2025 19:13:44 +0100 Subject: [PATCH 07/11] git --- .github/workflows/deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 015e4af..ff91aa8 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -71,7 +71,7 @@ jobs: Remove-Item -Recurse -Force "$arduinoLib\MQTTESP8266" } New-Item -ItemType Directory -Force -Path $arduinoLib - git clone https://github.com/Zefek/MQTTESP8266.git "$arduinoLib\MQTTESP8266" + & "$Env:RUNNER_TOOL_CACHE\git\bin\git" clone https://github.com/Zefek/MQTTESP8266.git "$arduinoLib\MQTTESP8266" - name: Set configs (Windows) shell: powershell From 9ee22c3a473641cfed0f4388296f1160bbe3e8c8 Mon Sep 17 00:00:00 2001 From: Zefek Date: Wed, 10 Dec 2025 14:58:08 +0100 Subject: [PATCH 08/11] config --- .github/workflows/deployment.yml | 58 ++++---------------------------- 1 file changed, 6 insertions(+), 52 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index ff91aa8..9a705e6 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -9,69 +9,23 @@ jobs: environment: Home steps: - - name: Show basic GitHub context - run: | - echo "Repository: ${{ github.repository }}" - echo "Ref: ${{ github.ref }}" - echo "Actor: ${{ github.actor }}" - - - name: Show runner environment variables (Linux/macOS) - if: runner.os != 'Windows' - run: | - echo "RUNNER_TOOL_CACHE: $RUNNER_TOOL_CACHE" - echo "RUNNER_TEMP: $RUNNER_TEMP" - echo "HOME: $HOME" - echo "PATH: $PATH" - - - name: Show runner environment variables (Windows) - if: runner.os == 'Windows' - run: | - echo "RUNNER_TOOL_CACHE: $Env:RUNNER_TOOL_CACHE" - echo "RUNNER_TEMP: $Env:RUNNER_TEMP" - echo "USERPROFILE: $Env:USERPROFILE" - echo "PATH: $Env:PATH" - - - name: List all environment variables (Linux/macOS) - if: runner.os != 'Windows' - run: printenv - name: Checkout repository uses: actions/checkout@v3 - - name: Install Arduino CLI (Windows) - shell: powershell - run: | - $url = "https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_64bit.zip" - $out = "$Env:RUNNER_TOOL_CACHE\arduino-cli.zip" - Invoke-WebRequest -Uri $url -OutFile $out - - $target = "$Env:RUNNER_TOOL_CACHE\arduino-cli" - Expand-Archive -Path $out -DestinationPath $target -Force - - # Přidat do PATH jen pro tento job - $env:PATH = "$target;$env:PATH" - - # Volitelně: otestovat - & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" version - - name: Initialize Arduino CLI run: | - & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" config init - & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" core update-index + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" config.yaml config init + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" config.yaml core update-index - name: Install required board core run: | - & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" core install arduino:avr + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" config.yaml core install arduino:avr - name: Install custom Arduino libraries (Windows) shell: powershell run: | - $arduinoLib = "$env:USERPROFILE\Documents\Arduino\libraries" - if (Test-Path "$arduinoLib\MQTTESP8266") { - Remove-Item -Recurse -Force "$arduinoLib\MQTTESP8266" - } - New-Item -ItemType Directory -Force -Path $arduinoLib - & "$Env:RUNNER_TOOL_CACHE\git\bin\git" clone https://github.com/Zefek/MQTTESP8266.git "$arduinoLib\MQTTESP8266" + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" config.yaml lib install MQTTESP8266 - name: Set configs (Windows) shell: powershell @@ -82,9 +36,9 @@ jobs: - name: Compile Arduino project run: | - & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" compile --fqbn arduino:avr:uno ./ --output-dir build + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" 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" upload --fqbn arduino:avr:uno --port $port --input-dir build + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" config.yaml upload --fqbn arduino:avr:uno --port $port --input-dir build From 85c59c77056181f281cb49f3370fb1c0301ad3f5 Mon Sep 17 00:00:00 2001 From: Zefek Date: Wed, 10 Dec 2025 15:03:07 +0100 Subject: [PATCH 09/11] parametr --- .github/workflows/deployment.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 9a705e6..4132830 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -15,17 +15,17 @@ jobs: - name: Initialize Arduino CLI run: | - & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" config.yaml config init - & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" config.yaml core update-index + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file config.yaml config init + & "$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.yaml core install arduino:avr + & "$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.yaml lib install MQTTESP8266 + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file config.yaml lib install MQTTESP8266 - name: Set configs (Windows) shell: powershell @@ -36,9 +36,9 @@ jobs: - name: Compile Arduino project run: | - & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" config.yaml compile --fqbn arduino:avr:uno ./ --output-dir build + & "$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.yaml upload --fqbn arduino:avr:uno --port $port --input-dir build + & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file config.yaml upload --fqbn arduino:avr:uno --port $port --input-dir build From 4b48c5fd76f9539f77feef721a3e3826ac33ae99 Mon Sep 17 00:00:00 2001 From: Zefek Date: Wed, 10 Dec 2025 15:28:26 +0100 Subject: [PATCH 10/11] config init --- .github/workflows/deployment.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 4132830..d698a26 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -15,7 +15,6 @@ jobs: - name: Initialize Arduino CLI run: | - & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file config.yaml config init & "$Env:RUNNER_TOOL_CACHE\arduino-cli\arduino-cli.exe" --config-file config.yaml core update-index - name: Install required board core From 6538118b07d53d71e12b41398b02d60c0d7a2272 Mon Sep 17 00:00:00 2001 From: Zefek Date: Fri, 12 Dec 2025 09:49:18 +0100 Subject: [PATCH 11/11] runner label --- .github/workflows/deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index d698a26..6b9e7ef 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -5,7 +5,7 @@ on: jobs: deployment: - runs-on: self-hosted + runs-on: [self-hosted, iot] environment: Home steps: