feat: update Gitea release workflow and increment version to 1.2.36
This commit is contained in:
parent
fadb122d28
commit
680aed0e10
136
.github/workflows/providers/gitea-release.yml
vendored
136
.github/workflows/providers/gitea-release.yml
vendored
@ -2,61 +2,98 @@ 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
|
||||
|
||||
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: |
|
||||
# System-Level Dependencies
|
||||
echo "Installing system dependencies..."
|
||||
echo "Current directory: $(pwd)"
|
||||
|
||||
# Systemabhängigkeiten
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y python3-minimal python3-pip curl
|
||||
sudo apt-get install -y build-essential gcc git wget
|
||||
|
||||
# Verify Python installation
|
||||
echo "Python version:"
|
||||
python3 --version
|
||||
# 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
|
||||
|
||||
# Verify pip installation
|
||||
echo "Pip version:"
|
||||
pip3 --version
|
||||
# PATH aktualisieren
|
||||
echo "$HOME/.platformio/penv/bin" >> $GITHUB_PATH
|
||||
export PATH="$HOME/.platformio/penv/bin:$PATH"
|
||||
|
||||
# Install Python packages
|
||||
echo "Installing Python packages..."
|
||||
python3 -m pip install --user platformio
|
||||
python3 -m pip install --user esptool
|
||||
echo "Verifying installation:"
|
||||
pio --version
|
||||
python --version
|
||||
gcc --version
|
||||
|
||||
# Add local bin to PATH
|
||||
echo "${HOME}/.local/bin" >> $GITHUB_PATH
|
||||
export PATH="${HOME}/.local/bin:$PATH"
|
||||
echo "Project contents:"
|
||||
ls -la
|
||||
|
||||
# Verify installations
|
||||
echo "PlatformIO version:"
|
||||
pio --version || echo "PlatformIO not found in PATH"
|
||||
|
||||
echo "Esptool version:"
|
||||
esptool.py version || echo "Esptool not found in PATH"
|
||||
|
||||
- name: Build Firmware
|
||||
- name: Prepare Build Environment
|
||||
run: |
|
||||
# Ensure PlatformIO is in PATH
|
||||
export PATH="${HOME}/.local/bin:$PATH"
|
||||
# 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
|
||||
|
||||
echo "Building SPIFFS..."
|
||||
python3 -m platformio run -t buildfs
|
||||
pio run -e esp32dev -t buildfs -v
|
||||
|
||||
echo "Building firmware..."
|
||||
python3 -m platformio run
|
||||
echo "Build output:"
|
||||
ls -la .pio/build/esp32dev/
|
||||
|
||||
- name: Merge Firmware Files
|
||||
run: |
|
||||
export PATH="${HOME}/.local/bin:$PATH"
|
||||
pip install esptool==4.5.1
|
||||
|
||||
python3 -m esptool --chip esp32 merge_bin \
|
||||
echo "Available files:"
|
||||
ls -la .pio/build/esp32dev/
|
||||
|
||||
esptool.py --chip esp32 merge_bin \
|
||||
--flash_mode dio \
|
||||
--flash_freq 40m \
|
||||
--flash_size 4MB \
|
||||
@ -68,29 +105,45 @@ jobs:
|
||||
|
||||
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:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
SERVER_URL: ${{ inputs.server_url }}
|
||||
run: |
|
||||
# Basis-Variablen setzen
|
||||
API_BASE="${GITEA_SERVER_URL}/api/v1"
|
||||
# Basis-Variablen
|
||||
API_BASE="${GITEA_SERVER_URL:-${SERVER_URL}}/api/v1"
|
||||
REPO="${GITEA_REPOSITORY}"
|
||||
TAG="${GITEA_REF_NAME}"
|
||||
|
||||
echo "Creating release for ${TAG}..."
|
||||
echo "Release configuration:"
|
||||
echo "API Base: $API_BASE"
|
||||
echo "Repository: $REPO"
|
||||
echo "Tag: $TAG"
|
||||
|
||||
# Test API-Verbindung
|
||||
echo "Testing API connection..."
|
||||
curl -k -v \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
"${API_BASE}/version"
|
||||
|
||||
# Release erstellen
|
||||
RESPONSE=$(curl -k -f -s \
|
||||
echo "Creating release..."
|
||||
RESPONSE=$(curl -k -v \
|
||||
-X POST \
|
||||
-H "accept: application/json" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"${TAG}\",\"name\":\"Release ${TAG}\"}" \
|
||||
"${API_BASE}/repos/${REPO}/releases")
|
||||
|
||||
echo "Release response:"
|
||||
echo "$RESPONSE"
|
||||
|
||||
# Release ID extrahieren
|
||||
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | cut -d':' -f2)
|
||||
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"
|
||||
@ -98,9 +151,9 @@ jobs:
|
||||
# Binärdateien hochladen
|
||||
for file in "filaman_full.bin" "filaman_ota.bin"; do
|
||||
echo "Uploading $file..."
|
||||
curl -k -f -s \
|
||||
curl -k -v \
|
||||
-X POST \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
-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"
|
||||
@ -109,6 +162,5 @@ jobs:
|
||||
echo "Upload completed"
|
||||
else
|
||||
echo "Failed to create release"
|
||||
echo "$RESPONSE"
|
||||
exit 1
|
||||
fi
|
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
@ -10,6 +10,7 @@ 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
|
||||
@ -20,6 +21,7 @@ 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
|
||||
@ -28,17 +30,24 @@ jobs:
|
||||
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
|
||||
elif [ "${GITHUB_ACTIONS}" = "true" ]; then
|
||||
PROVIDER="github"
|
||||
fi
|
||||
|
||||
echo "Detected provider: ${PROVIDER}"
|
||||
echo "provider=${PROVIDER}" >> "${GITHUB_OUTPUT}"
|
||||
echo "Server URL: ${SERVER_URL}"
|
||||
|
||||
{
|
||||
echo "provider=${PROVIDER}"
|
||||
echo "server_url=${SERVER_URL}"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
verify-provider:
|
||||
needs: route
|
||||
@ -47,6 +56,7 @@ 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
|
||||
@ -61,3 +71,7 @@ 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 }}
|
@ -9,7 +9,7 @@
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[common]
|
||||
version = "1.2.35"
|
||||
version = "1.2.36"
|
||||
|
||||
[env:esp32dev]
|
||||
platform = espressif32
|
||||
|
Loading…
x
Reference in New Issue
Block a user