2025-02-19 01:19:42 +01:00
|
|
|
name: Gitea Release
|
|
|
|
|
|
|
|
on:
|
2025-02-19 10:24:43 +01:00
|
|
|
workflow_call:
|
2025-02-19 01:19:42 +01:00
|
|
|
|
|
|
|
jobs:
|
2025-02-19 10:24:43 +01:00
|
|
|
create-release:
|
2025-02-19 09:39:41 +01:00
|
|
|
runs-on: ubuntu-latest
|
2025-02-19 01:19:42 +01:00
|
|
|
steps:
|
2025-02-19 11:18:05 +01:00
|
|
|
- name: Checkout Repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Install Build Dependencies
|
2025-02-19 11:01:54 +01:00
|
|
|
run: |
|
2025-02-19 11:18:05 +01:00
|
|
|
# System-Level Dependencies
|
|
|
|
echo "Installing system dependencies..."
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y python3-minimal python3-pip curl
|
|
|
|
|
|
|
|
# Verify Python installation
|
|
|
|
echo "Python version:"
|
|
|
|
python3 --version
|
|
|
|
|
|
|
|
# Verify pip installation
|
|
|
|
echo "Pip version:"
|
|
|
|
pip3 --version
|
|
|
|
|
|
|
|
# Install Python packages
|
|
|
|
echo "Installing Python packages..."
|
|
|
|
python3 -m pip install --user platformio
|
|
|
|
python3 -m pip install --user esptool
|
|
|
|
|
|
|
|
# Add local bin to PATH
|
|
|
|
echo "${HOME}/.local/bin" >> $GITHUB_PATH
|
|
|
|
export PATH="${HOME}/.local/bin:$PATH"
|
|
|
|
|
|
|
|
# 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"
|
|
|
|
|
2025-02-19 11:01:54 +01:00
|
|
|
- name: Build Firmware
|
|
|
|
run: |
|
2025-02-19 11:18:05 +01:00
|
|
|
# Ensure PlatformIO is in PATH
|
|
|
|
export PATH="${HOME}/.local/bin:$PATH"
|
2025-02-19 11:01:54 +01:00
|
|
|
|
2025-02-19 11:18:05 +01:00
|
|
|
echo "Building SPIFFS..."
|
|
|
|
python3 -m platformio run -t buildfs
|
2025-02-19 11:01:54 +01:00
|
|
|
|
2025-02-19 11:18:05 +01:00
|
|
|
echo "Building firmware..."
|
|
|
|
python3 -m platformio run
|
|
|
|
|
|
|
|
- name: Merge Firmware Files
|
2025-02-19 11:01:54 +01:00
|
|
|
run: |
|
2025-02-19 11:18:05 +01:00
|
|
|
export PATH="${HOME}/.local/bin:$PATH"
|
|
|
|
|
|
|
|
python3 -m esptool --chip esp32 merge_bin \
|
2025-02-19 11:01:54 +01:00
|
|
|
--flash_mode dio \
|
|
|
|
--flash_freq 40m \
|
|
|
|
--flash_size 4MB \
|
|
|
|
-o .pio/build/esp32dev/filaman_full.bin \
|
|
|
|
0x1000 .pio/build/esp32dev/bootloader.bin \
|
|
|
|
0x8000 .pio/build/esp32dev/partitions.bin \
|
|
|
|
0x10000 .pio/build/esp32dev/firmware.bin \
|
|
|
|
0x290000 .pio/build/esp32dev/spiffs.bin
|
2025-02-19 11:18:05 +01:00
|
|
|
|
2025-02-19 11:01:54 +01:00
|
|
|
cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_ota.bin
|
2025-02-19 10:24:43 +01:00
|
|
|
|
2025-02-19 11:18:05 +01:00
|
|
|
- name: Create Release
|
|
|
|
shell: bash
|
2025-02-19 10:24:43 +01:00
|
|
|
env:
|
|
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
2025-02-19 09:39:41 +01:00
|
|
|
run: |
|
2025-02-19 11:18:05 +01:00
|
|
|
# Basis-Variablen setzen
|
|
|
|
API_BASE="${GITEA_SERVER_URL}/api/v1"
|
2025-02-19 10:24:43 +01:00
|
|
|
REPO="${GITEA_REPOSITORY}"
|
|
|
|
TAG="${GITEA_REF_NAME}"
|
2025-02-19 09:39:41 +01:00
|
|
|
|
2025-02-19 11:18:05 +01:00
|
|
|
echo "Creating release for ${TAG}..."
|
2025-02-19 10:07:41 +01:00
|
|
|
|
2025-02-19 11:18:05 +01:00
|
|
|
# Release erstellen
|
|
|
|
RESPONSE=$(curl -k -f -s \
|
|
|
|
-X POST \
|
2025-02-19 10:37:41 +01:00
|
|
|
-H "accept: application/json" \
|
2025-02-19 10:24:43 +01:00
|
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
|
|
-H "Content-Type: application/json" \
|
2025-02-19 11:18:05 +01:00
|
|
|
-d "{\"tag_name\":\"${TAG}\",\"name\":\"Release ${TAG}\"}" \
|
|
|
|
"${API_BASE}/repos/${REPO}/releases")
|
2025-02-19 10:37:41 +01:00
|
|
|
|
2025-02-19 11:18:05 +01:00
|
|
|
# Release ID extrahieren
|
|
|
|
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | cut -d':' -f2)
|
2025-02-19 10:24:43 +01:00
|
|
|
|
2025-02-19 11:18:05 +01:00
|
|
|
if [ -n "$RELEASE_ID" ]; then
|
|
|
|
echo "Release created with ID: $RELEASE_ID"
|
2025-02-19 10:37:41 +01:00
|
|
|
|
2025-02-19 11:18:05 +01:00
|
|
|
# Binärdateien hochladen
|
|
|
|
for file in "filaman_full.bin" "filaman_ota.bin"; do
|
|
|
|
echo "Uploading $file..."
|
|
|
|
curl -k -f -s \
|
|
|
|
-X POST \
|
|
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
|
|
-H "Content-Type: application/octet-stream" \
|
|
|
|
--data-binary "@.pio/build/esp32dev/$file" \
|
|
|
|
"${API_BASE}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=$file"
|
|
|
|
done
|
2025-02-19 10:24:43 +01:00
|
|
|
|
2025-02-19 11:18:05 +01:00
|
|
|
echo "Upload completed"
|
|
|
|
else
|
|
|
|
echo "Failed to create release"
|
|
|
|
echo "$RESPONSE"
|
|
|
|
exit 1
|
|
|
|
fi
|