diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b818f0..b9d3957 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,13 +24,13 @@ jobs: - name: Installing platformio run: pip3 install -U platformio - # - name: Building a firmware for ESP32 - # run: | - # export SSID=${{ secrets.WIFI_SSID }} - # export PASS=${{ secrets.WIFI_PASS }} - # export JOINCODE=${{ secrets.HUSARNET_JOINCODE }} - # export HOSTNAME=${{ secrets.HUSARNET_HOSTNAME }} - # pio run + - name: Building a firmware for ESP32 + run: | + export SSID=${{ secrets.WIFI_SSID }} + export PASS=${{ secrets.WIFI_PASS }} + export JOINCODE=${{ secrets.HUSARNET_JOINCODE }} + export HOSTNAME=${{ secrets.HUSARNET_HOSTNAME }} + pio run # - name: Uploading a firmware to ESP32 # run: > diff --git a/platformio.ini b/platformio.ini index 519e3cc..80027e3 100644 --- a/platformio.ini +++ b/platformio.ini @@ -20,4 +20,8 @@ board_build.partitions = min_spiffs.csv board_build.embed_txtfiles = src/index.html - +build_flags = + '-DWIFI_SSID="${sysenv.SSID}"' + '-DWIFI_PASS="${sysenv.PASS}"' + '-DHUSARNET_HOSTNAME="${sysenv.HOSTNAME}"' + '-DHUSARNET_JOINCODE="${sysenv.JOINCODE}"' diff --git a/src/simple-webserver.ino b/src/simple-webserver.ino index 5fd071f..5e5cf3b 100644 --- a/src/simple-webserver.ino +++ b/src/simple-webserver.ino @@ -5,7 +5,20 @@ // For local development (rename credenials-template.h and type your WiFi and // Husarnet credentials there) +#if __has_include("credentials.h") #include "credentials.h" +#else +// For GitHub Actions + +// WiFi credentials +const char *ssid = WIFI_SSID; +const char *password = WIFI_PASS; + +// Husarnet credentials +const char *hostName = HUSARNET_HOSTNAME; +const char *husarnetJoinCode = HUSARNET_JOINCODE; // find at app.husarnet.com +const char *dashboardURL = "default"; +#endif #define HTTP_PORT 8080 @@ -77,7 +90,7 @@ void setup(void) { // Configure camera // Tested on M5CAMERA X - + esp32cam::Config cfg; cfg.setPins(esp32cam::pins::M5CameraLED);