From 0f1a3b1d5b51de9bd7e49d9b26381e1859403a99 Mon Sep 17 00:00:00 2001 From: Manuel Weiser Date: Wed, 19 Feb 2025 11:46:17 +0100 Subject: [PATCH] feat: update Gitea release workflow and increment version to 1.2.37 --- .github/workflows/providers/gitea-release.yml | 132 +++++------------- .github/workflows/release.yml | 26 +--- platformio.ini | 2 +- 3 files changed, 40 insertions(+), 120 deletions(-) diff --git a/.github/workflows/providers/gitea-release.yml b/.github/workflows/providers/gitea-release.yml index bde2071..ac0da45 100644 --- a/.github/workflows/providers/gitea-release.yml +++ b/.github/workflows/providers/gitea-release.yml @@ -2,12 +2,6 @@ name: Gitea Release on: workflow_call: - inputs: - server_url: - description: 'Gitea server URL' - required: false - type: string - default: 'https://gitea.your-domain.com' secrets: GITEA_TOKEN: required: true @@ -15,84 +9,44 @@ on: jobs: create-release: runs-on: ubuntu-latest - environment: production steps: - name: Checkout Repository uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.9' - name: Install Build Dependencies run: | - echo "Current directory: $(pwd)" + # Add PlatformIO repository + curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/develop/platformio/assets/system/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules - # Systemabhängigkeiten + sudo curl -fsSL -o /etc/apt/trusted.gpg.d/platformio.gpg https://github.com/platformio/platformio-core/releases/download/v6.1.11/platformio-keyring.gpg + echo "deb https://github.com/platformio/platformio-core/releases/download/v6.1.11/ any/" | sudo tee /etc/apt/sources.list.d/platformio.list + + # Install dependencies sudo apt-get update - sudo apt-get install -y build-essential gcc git wget + sudo apt-get install -y platformio-core python3-pip build-essential - # PlatformIO CLI installieren - curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/master/scripts/get-platformio.py -o get-platformio.py - python3 get-platformio.py + # Install esptool + sudo pip3 install esptool==4.5.1 - # PATH aktualisieren - echo "$HOME/.platformio/penv/bin" >> $GITHUB_PATH - export PATH="$HOME/.platformio/penv/bin:$PATH" - - echo "Verifying installation:" + echo "Verifying installations:" pio --version - python --version - gcc --version - - echo "Project contents:" - ls -la + python3 --version + esptool.py version - - name: Prepare Build Environment + - name: Build Firmware run: | - # PlatformIO Core initialisieren - pio platform install "espressif32" - - echo "Installing libraries..." - pio lib install \ - "tzapu/WiFiManager @ ^2.0.17" \ - "https://github.com/me-no-dev/ESPAsyncWebServer.git" \ - "me-no-dev/AsyncTCP @ ^1.1.1" \ - "bogde/HX711 @ ^0.7.5" \ - "adafruit/Adafruit SSD1306 @ ^2.5.13" \ - "adafruit/Adafruit GFX Library @ ^1.11.11" \ - "adafruit/Adafruit PN532 @ ^1.3.3" \ - "bblanchon/ArduinoJson @ ^7.3.0" \ - "knolleary/PubSubClient @ ^2.8" \ - "digitaldragon/SSLClient @ ^1.3.2" - - echo "Installed libraries:" - pio lib list - - - name: Build Project - run: | - # PlatformIO Core Variablen setzen - export PLATFORMIO_BUILD_FLAGS="-D VERSION=\\"1.2.35\\" -DNDEBUG" - - echo "Building project..." - pio run -e esp32dev -v + # Initialize project + pio project init --board esp32dev echo "Building SPIFFS..." - pio run -e esp32dev -t buildfs -v + pio run -t buildfs -v - echo "Build output:" - ls -la .pio/build/esp32dev/ + echo "Building firmware..." + pio run -v - - name: Merge Firmware Files + - name: Create Release Files run: | - pip install esptool==4.5.1 - - echo "Available files:" - ls -la .pio/build/esp32dev/ - + echo "Creating release files..." esptool.py --chip esp32 merge_bin \ --flash_mode dio \ --flash_freq 40m \ @@ -104,63 +58,47 @@ jobs: 0x290000 .pio/build/esp32dev/spiffs.bin cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_ota.bin - - echo "Final binaries:" - ls -la .pio/build/esp32dev/filaman_*.bin - name: Create Release - shell: bash env: TOKEN: ${{ secrets.GITEA_TOKEN }} - SERVER_URL: ${{ inputs.server_url }} run: | - # Basis-Variablen - API_BASE="${GITEA_SERVER_URL:-${SERVER_URL}}/api/v1" - REPO="${GITEA_REPOSITORY}" TAG="${GITEA_REF_NAME}" + API_URL="${GITEA_SERVER_URL}/api/v1" + REPO="${GITEA_REPOSITORY}" - echo "Release configuration:" - echo "API Base: $API_BASE" - echo "Repository: $REPO" - echo "Tag: $TAG" + echo "Debug environment:" + echo "TAG: ${TAG}" + echo "API_URL: ${API_URL}" + echo "REPO: ${REPO}" - # Test API-Verbindung - echo "Testing API connection..." - curl -k -v \ - -H "Authorization: token ${TOKEN}" \ - "${API_BASE}/version" + echo "Creating release for ${TAG} on ${REPO}..." - # Release erstellen - echo "Creating release..." - RESPONSE=$(curl -k -v \ + # Create release + RESPONSE=$(curl -k -s \ -X POST \ -H "Authorization: token ${TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"${TAG}\",\"name\":\"Release ${TAG}\"}" \ - "${API_BASE}/repos/${REPO}/releases") + "${API_URL}/repos/${REPO}/releases") - echo "Release response:" - echo "$RESPONSE" - - # Release ID extrahieren RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | cut -d':' -f2 | head -n1) if [ -n "$RELEASE_ID" ]; then echo "Release created with ID: $RELEASE_ID" - # Binärdateien hochladen + # Upload files for file in "filaman_full.bin" "filaman_ota.bin"; do echo "Uploading $file..." - curl -k -v \ + curl -k -s \ -X POST \ -H "Authorization: token ${TOKEN}" \ -H "Content-Type: application/octet-stream" \ --data-binary "@.pio/build/esp32dev/$file" \ - "${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=$file" + "${API_URL}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=$file" done - - echo "Upload completed" else - echo "Failed to create release" + echo "Failed to create release. Response:" + echo "$RESPONSE" exit 1 fi \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c16bd12..f52d85d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,6 @@ jobs: runs-on: ubuntu-latest outputs: provider: ${{ steps.provider.outputs.provider }} - server_url: ${{ steps.provider.outputs.server_url }} steps: - name: Checkout Repository uses: actions/checkout@v3 @@ -21,33 +20,19 @@ jobs: echo "GITHUB_ACTIONS=${GITHUB_ACTIONS:-not set}" echo "GITEA_ACTIONS=${GITEA_ACTIONS:-not set}" echo "GITEA_REPOSITORY=${GITEA_REPOSITORY:-not set}" - echo "GITEA_SERVER_URL=${GITEA_SERVER_URL:-not set}" echo "RUNNER_NAME=${RUNNER_NAME:-not set}" - name: Determine CI Provider id: provider shell: bash run: | - # Initialize provider as unknown - PROVIDER="unknown" - SERVER_URL="" - - # Check for Gitea specific environment first if [ -n "${GITEA_ACTIONS}" ] || [ -n "${GITEA_REPOSITORY}" ] || [[ "${RUNNER_NAME}" == *"gitea"* ]]; then - PROVIDER="gitea" - SERVER_URL="${GITEA_SERVER_URL}" - # Then check for GitHub + echo "provider=gitea" >> "$GITHUB_OUTPUT" elif [ "${GITHUB_ACTIONS}" = "true" ]; then - PROVIDER="github" + echo "provider=github" >> "$GITHUB_OUTPUT" + else + echo "provider=unknown" >> "$GITHUB_OUTPUT" fi - - echo "Detected provider: ${PROVIDER}" - echo "Server URL: ${SERVER_URL}" - - { - echo "provider=${PROVIDER}" - echo "server_url=${SERVER_URL}" - } >> "$GITHUB_OUTPUT" verify-provider: needs: route @@ -56,7 +41,6 @@ jobs: - name: Echo detected provider run: | echo "Detected CI Provider: ${{ needs.route.outputs.provider }}" - echo "Server URL: ${{ needs.route.outputs.server_url }}" if [ "${{ needs.route.outputs.provider }}" = "unknown" ]; then echo "::error::Failed to detect CI provider!" exit 1 @@ -71,7 +55,5 @@ jobs: needs: [route, verify-provider] if: needs.route.outputs.provider == 'gitea' uses: ./.github/workflows/providers/gitea-release.yml - with: - server_url: ${{ needs.route.outputs.server_url }} secrets: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} \ No newline at end of file diff --git a/platformio.ini b/platformio.ini index 24ae182..b60c181 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,7 +9,7 @@ ; https://docs.platformio.org/page/projectconf.html [common] -version = "1.2.36" +version = "1.2.37" [env:esp32dev] platform = espressif32