Compare commits

..

5 Commits

Author SHA1 Message Date
265ff0c787 docs: update changelog for version 1.2.98
All checks were successful
Release Workflow / route (push) Successful in 6s
Release Workflow / verify-provider (push) Successful in 2s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 2m28s
2025-02-21 13:52:27 +01:00
67eca82ac5 docs: update webpages for version v1.2.98 2025-02-21 13:52:27 +01:00
568db90db0 docs: update changelog for version 1.2.97
All checks were successful
Release Workflow / route (push) Successful in 7s
Release Workflow / verify-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 2m37s
2025-02-21 12:34:25 +01:00
2dfd53d64a docs: update webpages for version v1.2.97 2025-02-21 12:34:25 +01:00
262a2fcbd4 refactor: streamline Gitea and GitHub release workflows to check for data changes and update binary handling 2025-02-21 12:34:20 +01:00
5 changed files with 168 additions and 85 deletions

View File

@ -3,9 +3,6 @@ name: Gitea Release
on:
workflow_call:
inputs:
gitea_ref_name:
required: true
type: string
gitea_server_url:
required: true
type: string
@ -48,30 +45,66 @@ jobs:
echo "SPIFFS_CHANGED=false" >> $GITHUB_OUTPUT
fi
- name: Check for Data changes
id: check_data
run: |
git fetch --unshallow || true
CHANGED_FILES=$(git diff --name-only HEAD^..HEAD)
if echo "$CHANGED_FILES" | grep -q "^data/"; then
echo "DATA_CHANGED=true" >> $GITHUB_OUTPUT
else
echo "DATA_CHANGED=false" >> $GITHUB_OUTPUT
fi
- name: Get version from platformio.ini
id: get_version
run: |
VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Build Firmware
run: |
# Get version from platformio.ini
VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
VERSION=${{ steps.get_version.outputs.VERSION }}
# Always build firmware
# Always build firmware and SPIFFS
echo "Building firmware and SPIFFS..."
pio run -e esp32dev
pio run -t buildfs
# Copy firmware binary
cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_${VERSION}.bin
# Only build SPIFFS if changed
if [[ "${{ steps.check_spiffs.outputs.SPIFFS_CHANGED }}" == "true" ]]; then
echo "Building SPIFFS due to changes..."
pio run -t buildfs
# Create full binary (always)
(cd .pio/build/esp32dev && \
esptool.py --chip esp32 merge_bin \
--fill-flash-size 4MB \
--flash_mode dio \
--flash_freq 40m \
--flash_size 4MB \
-o filaman_full_${VERSION}.bin \
0x0000 bootloader.bin \
0x8000 partitions.bin \
0x10000 firmware.bin \
0x390000 spiffs.bin)
# Only copy SPIFFS binary if data changed
if [[ "${{ steps.check_data.outputs.DATA_CHANGED }}" == "true" ]]; then
echo "Data changes detected, copying SPIFFS binary..."
cp .pio/build/esp32dev/spiffs.bin .pio/build/esp32dev/webpage_${VERSION}.bin
fi
# Verify file sizes
echo "File sizes:"
(cd .pio/build/esp32dev && ls -lh *.bin)
- name: Prepare binaries
run: |
cd .pio/build/esp32dev
VERSION=$(grep '^version = ' ../../platformio.ini | cut -d'"' -f2)
VERSION=${{ steps.get_version.outputs.VERSION }}
# Create full binary only if SPIFFS changed
if [[ "${{ steps.check_spiffs.outputs.SPIFFS_CHANGED }}" == "true" ]]; then
echo "Creating full binary..."
cd .pio/build/esp32dev && \
esptool.py --chip esp32 merge_bin \
--fill-flash-size 4MB \
--flash_mode dio \
@ -86,16 +119,24 @@ jobs:
# Verify file sizes
echo "File sizes:"
ls -lh *.bin
cd .pio/build/esp32dev && ls -lh *.bin
- name: Read CHANGELOG.md
id: changelog
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
CHANGELOG=$(awk "/## \\[$VERSION\\]/{p=1;print;next} /## \\[/{p=0} p" CHANGELOG.md)
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
TAG="${{ inputs.gitea_ref_name }}"
API_URL="${{ inputs.gitea_server_url }}/api/v1"
REPO="${{ inputs.gitea_repository }}"
VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
VERSION=${{ steps.get_version.outputs.VERSION }}
# Create release
RESPONSE=$(curl -k -s \
@ -103,8 +144,8 @@ jobs:
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
-d "{
\"tag_name\":\"${TAG}\",
\"name\":\"Release ${TAG}\",
\"tag_name\":\"v${VERSION}\",
\"name\":\"Release ${VERSION}\",
\"body\":\"${{ steps.changelog.outputs.CHANGES }}\"
}" \
"${API_URL}/repos/${REPO}/releases")
@ -113,30 +154,30 @@ jobs:
if [ -n "$RELEASE_ID" ]; then
echo "Release created with ID: $RELEASE_ID"
cd .pio/build/esp32dev
# Always upload firmware
if [ -f "filaman_${VERSION}.bin" ]; then
curl -k -s \
-X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/octet-stream" \
--data-binary "@filaman_${VERSION}.bin" \
"${API_URL}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=filaman_${VERSION}.bin"
fi
# Upload SPIFFS and full binary only if they exist
for file in webpage_${VERSION}.bin filaman_full_${VERSION}.bin; do
if [ -f "$file" ]; then
# Always upload firmware and full binary
for file in filaman_${VERSION}.bin filaman_full_${VERSION}.bin; do
if [ -f ".pio/build/esp32dev/$file" ]; then
echo "Uploading $file..."
curl -k -s \
-X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$file" \
--data-binary "@.pio/build/esp32dev/$file" \
"${API_URL}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=$file"
fi
done
# Upload SPIFFS binary only if it exists (data changes)
if [ -f ".pio/build/esp32dev/webpage_${VERSION}.bin" ]; then
echo "Uploading webpage binary..."
curl -k -s \
-X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/octet-stream" \
--data-binary "@.pio/build/esp32dev/webpage_${VERSION}.bin" \
"${API_URL}/repos/${REPO}/releases/${RELEASE_ID}/assets?name=webpage_${VERSION}.bin"
fi
else
echo "Failed to create release. Response:"
echo "$RESPONSE"

View File

@ -26,61 +26,57 @@ jobs:
sudo apt-get update
sudo apt-get install xxd
- name: Check for SPIFFS changes
id: check_spiffs
- name: Check for Data changes
id: check_data
run: |
git fetch --unshallow || true
CHANGED_FILES=$(git diff --name-only HEAD^..HEAD)
if echo "$CHANGED_FILES" | grep -q "^data/\|^html/"; then
echo "SPIFFS_CHANGED=true" >> $GITHUB_OUTPUT
if echo "$CHANGED_FILES" | grep -q "^data/"; then
echo "DATA_CHANGED=true" >> $GITHUB_OUTPUT
else
echo "SPIFFS_CHANGED=false" >> $GITHUB_OUTPUT
echo "DATA_CHANGED=false" >> $GITHUB_OUTPUT
fi
- name: Build Firmware
run: |
# Get version from platformio.ini
VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
# Always build firmware
# Always build firmware and SPIFFS
echo "Building firmware and SPIFFS..."
pio run -e esp32dev
pio run -t buildfs
# Copy firmware binary
cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_${VERSION}.bin
# Only build SPIFFS if changed
if [[ "${{ steps.check_spiffs.outputs.SPIFFS_CHANGED }}" == "true" ]]; then
echo "Building SPIFFS due to changes..."
pio run -t buildfs
# Create full binary (always)
(cd .pio/build/esp32dev && \
esptool.py --chip esp32 merge_bin \
--fill-flash-size 4MB \
--flash_mode dio \
--flash_freq 40m \
--flash_size 4MB \
-o filaman_full_${VERSION}.bin \
0x0000 bootloader.bin \
0x8000 partitions.bin \
0x10000 firmware.bin \
0x390000 spiffs.bin)
# Only copy SPIFFS binary if data changed
if [[ "${{ steps.check_data.outputs.DATA_CHANGED }}" == "true" ]]; then
echo "Data changes detected, copying SPIFFS binary..."
cp .pio/build/esp32dev/spiffs.bin .pio/build/esp32dev/webpage_${VERSION}.bin
fi
- name: Prepare binaries
run: |
cd .pio/build/esp32dev
VERSION=$(grep '^version = ' ../../platformio.ini | cut -d'"' -f2)
# Create full binary only if SPIFFS changed
if [[ "${{ steps.check_spiffs.outputs.SPIFFS_CHANGED }}" == "true" ]]; then
echo "Creating full binary..."
esptool.py --chip esp32 merge_bin \
--fill-flash-size 4MB \
--flash_mode dio \
--flash_freq 40m \
--flash_size 4MB \
-o filaman_full_${VERSION}.bin \
0x0000 bootloader.bin \
0x8000 partitions.bin \
0x10000 firmware.bin \
0x390000 spiffs.bin
fi
# Verify file sizes
echo "File sizes:"
ls -lh *.bin
(cd .pio/build/esp32dev && ls -lh *.bin)
- name: Get version from tag
- name: Get version from platformio.ini
id: get_version
run: |
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Read CHANGELOG.md
id: changelog
@ -95,8 +91,10 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION=${{ steps.get_version.outputs.VERSION }}
# Create release with available files
cd .pio/build/esp32dev
VERSION=$(grep '^version = ' ../../platformio.ini | cut -d'"' -f2)
FILES_TO_UPLOAD=""
# Always add firmware
@ -115,8 +113,8 @@ jobs:
# Create release with available files
if [ -n "$FILES_TO_UPLOAD" ]; then
gh release create "${{ github.ref_name }}" \
--title "Release ${{ steps.get_version.outputs.VERSION }}" \
gh release create "v${VERSION}" \
--title "Release ${VERSION}" \
--notes "${{ steps.changelog.outputs.CHANGES }}" \
$FILES_TO_UPLOAD
else

View File

@ -1,5 +1,16 @@
# Changelog
## [1.2.98] - 2025-02-21
### Changed
- update webpages for version v1.2.98
## [1.2.97] - 2025-02-21
### Changed
- update webpages for version v1.2.97
- streamline Gitea and GitHub release workflows to check for data changes and update binary handling
## [1.2.96] - 2025-02-21
### Added
- add SPIFFS build step to Gitea and GitHub release workflows

View File

@ -79,7 +79,7 @@
</div>
<div class="progress-container" style="display: none;">
<div class="progress-bar">0%</</div>
<div class="progress-bar">0%</div>
</div>
<div class="status"></div>
</div>
@ -104,6 +104,42 @@
color: #666;
margin-bottom: 1rem;
}
.progress-container {
margin: 20px 0;
background: #f0f0f0;
border-radius: 4px;
overflow: hidden;
}
.progress-bar {
width: 0;
height: 20px;
background: #4CAF50;
transition: width 0.3s ease-in-out;
text-align: center;
line-height: 20px;
color: white;
}
.status {
margin-top: 20px;
padding: 10px;
border-radius: 4px;
display: none;
}
.status.success {
background: #e8f5e9;
color: #2e7d32;
}
.status.error {
background: #ffebee;
color: #c62828;
}
.warning {
background: #fff3e0;
color: #e65100;
padding: 15px;
border-radius: 4px;
margin-bottom: 20px;
}
</style>
<script>
@ -113,8 +149,13 @@
statusContainer.style.display = 'none';
}
const progress = document.querySelector('.progress-bar');
const progressContainer = document.querySelector('.progress-container');
const status = document.querySelector('.status');
function handleUpdate(e) {
e.preventDefault();
const form = e.target;
const file = form.update.files[0];
const updateType = form.dataset.type;
@ -132,25 +173,15 @@
alert('Please select a valid webpage file (webpage_*.bin)');
return;
}
log(`Selected file: ${file.name} (${file.size} bytes)`);
// Aktiviere Fortschrittsanzeige
progress.style.display = 'block';
form.style.display = 'none';
// Erstelle FormData für den Upload
const formData = new FormData();
formData.append('update', file);
const progress = document.querySelector('.progress-bar');
const progressContainer = document.querySelector('.progress-container');
const status = document.querySelector('.status');
progressContainer.style.display = 'block';
status.style.display = 'none';
status.className = 'status';
// Reset progress bar
progress.style.width = '0%';
progress.textContent = '0%';
// Disable both forms during update
document.querySelectorAll('form input[type=submit]').forEach(btn => btn.disabled = true);
@ -215,6 +246,8 @@
document.querySelectorAll('form input[type=submit]').forEach(btn => btn.disabled = false);
};
const formData = new FormData();
formData.append('update', file);
xhr.send(formData);
}

View File

@ -9,7 +9,7 @@
; https://docs.platformio.org/page/projectconf.html
[common]
version = "1.2.96"
version = "1.2.98"
[env:esp32dev]
platform = espressif32