Compare commits

..

9 Commits

Author SHA1 Message Date
069ec2d7a1 docs: update changelog for version 1.3.12
Some checks failed
Release Workflow / detect-provider (push) Successful in 3s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Failing after 2m45s
2025-02-21 21:13:40 +01:00
94e35ae86e docs: update webpages for version v1.3.12 2025-02-21 21:13:40 +01:00
d71e3d8184 ci: enhance GitHub release workflow with token handling and file upload improvements 2025-02-21 21:13:36 +01:00
bb166aa29f docs: update changelog for version 1.3.11
Some checks failed
Release Workflow / detect-provider (push) Successful in 4s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Failing after 2m55s
2025-02-21 21:07:19 +01:00
0d718023f8 docs: update webpages for version v1.3.11 2025-02-21 21:07:19 +01:00
b16781043f ci: refactor Gitea release workflow by simplifying input handling and removing unnecessary checks 2025-02-21 21:07:15 +01:00
dff184ff25 docs: update changelog for version 1.3.10
All checks were successful
Release Workflow / route (push) Successful in 7s
Release Workflow / github-release (push) Has been skipped
Release Workflow / gitea-release (push) Successful in 2m40s
2025-02-21 21:03:56 +01:00
0ce281221d docs: update webpages for version v1.3.10 2025-02-21 21:03:56 +01:00
bc26c160e8 ci: simplify GitHub release workflow by removing provider verification step 2025-02-21 21:03:52 +01:00
5 changed files with 96 additions and 190 deletions

View File

@ -2,16 +2,6 @@ name: Gitea Release
on: on:
workflow_call: workflow_call:
inputs:
gitea_server_url:
required: true
type: string
gitea_repository:
required: true
type: string
secrets:
GITEA_TOKEN:
required: true
jobs: jobs:
create-release: create-release:
@ -34,39 +24,11 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install xxd sudo apt-get install xxd
- name: Check for SPIFFS changes
id: check_spiffs
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
else
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 - name: Build Firmware
run: | run: |
VERSION=${{ steps.get_version.outputs.VERSION }} VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
# Always build firmware and SPIFFS # Build firmware and SPIFFS
echo "Building firmware and SPIFFS..." echo "Building firmware and SPIFFS..."
pio run -e esp32dev pio run -e esp32dev
pio run -t buildfs pio run -t buildfs
@ -74,10 +36,10 @@ jobs:
# Copy firmware binary # Copy firmware binary
cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_${VERSION}.bin cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_${VERSION}.bin
# Always create SPIFFS binary # Create SPIFFS binary
cp .pio/build/esp32dev/spiffs.bin .pio/build/esp32dev/webpage_${VERSION}.bin cp .pio/build/esp32dev/spiffs.bin .pio/build/esp32dev/webpage_${VERSION}.bin
# Create full binary (always) # Create full binary
(cd .pio/build/esp32dev && (cd .pio/build/esp32dev &&
esptool.py --chip esp32 merge_bin \ esptool.py --chip esp32 merge_bin \
--fill-flash-size 4MB \ --fill-flash-size 4MB \
@ -93,31 +55,13 @@ jobs:
# Verify file sizes # Verify file sizes
echo "File sizes:" echo "File sizes:"
(cd .pio/build/esp32dev && ls -lh *.bin) (cd .pio/build/esp32dev && ls -lh *.bin)
- name: Prepare binaries - name: Get version from platformio.ini
id: get_version
run: | run: |
VERSION=${{ steps.get_version.outputs.VERSION }} VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
# 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 \
--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:"
cd .pio/build/esp32dev && ls -lh *.bin
- name: Read CHANGELOG.md - name: Read CHANGELOG.md
id: changelog id: changelog
run: | run: |
@ -126,57 +70,20 @@ jobs:
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release - name: Create Gitea Release
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
run: | run: |
API_URL="${{ inputs.gitea_server_url }}/api/v1"
REPO="${{ inputs.gitea_repository }}"
VERSION=${{ steps.get_version.outputs.VERSION }} VERSION=${{ steps.get_version.outputs.VERSION }}
cd .pio/build/esp32dev
# Create release # Prepare files for upload
RESPONSE=$(curl -k -s \ FILES=""
-X POST \ for file in filaman_${VERSION}.bin webpage_${VERSION}.bin filaman_full_${VERSION}.bin; do
-H "Authorization: token ${TOKEN}" \ if [ -f "$file" ]; then
-H "Content-Type: application/json" \ FILES="$FILES -a $file"
-d "{
\"tag_name\":\"v${VERSION}\",
\"name\":\"Release ${VERSION}\",
\"body\":\"${{ steps.changelog.outputs.CHANGES }}\"
}" \
"${API_URL}/repos/${REPO}/releases")
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"
# 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 "@.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 fi
else done
echo "Failed to create release. Response:"
echo "$RESPONSE" # Create release using git command
exit 1 git tag -a "v${VERSION}" -m "Release ${VERSION}"
fi git push origin "v${VERSION}"

View File

@ -2,12 +2,19 @@ name: GitHub Release
on: on:
workflow_call: workflow_call:
secrets:
GITHUB_TOKEN:
description: 'GitHub token for release creation'
required: true
permissions:
contents: write
jobs: jobs:
create-release: create-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
#permissions: permissions:
# contents: write contents: write
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -97,35 +104,40 @@ jobs:
- name: Create GitHub Release - name: Create GitHub Release
env: env:
GH_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
VERSION=${{ steps.get_version.outputs.VERSION }} VERSION=${{ steps.get_version.outputs.VERSION }}
# Create release with available files
cd .pio/build/esp32dev cd .pio/build/esp32dev
FILES_TO_UPLOAD=""
# Always add firmware # Create the release first
if [ -f "filaman_${VERSION}.bin" ]; then RELEASE_JSON=$(curl -L \
FILES_TO_UPLOAD="$FILES_TO_UPLOAD filaman_${VERSION}.bin" -X POST \
fi -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/releases" \
-d "{
\"tag_name\":\"v${VERSION}\",
\"name\":\"Release ${VERSION}\",
\"body\":\"${{ steps.changelog.outputs.CHANGES }}\",
\"draft\":false,
\"prerelease\":false
}")
# Add SPIFFS and full binary only if they exist # Extract the upload URL from the response
if [ -f "webpage_${VERSION}.bin" ]; then UPLOAD_URL=$(echo "$RELEASE_JSON" | jq -r .upload_url | sed 's/{?name,label}//')
FILES_TO_UPLOAD="$FILES_TO_UPLOAD webpage_${VERSION}.bin"
fi
if [ -f "filaman_full_${VERSION}.bin" ]; then # Upload the binary files
FILES_TO_UPLOAD="$FILES_TO_UPLOAD filaman_full_${VERSION}.bin" for file in filaman_${VERSION}.bin webpage_${VERSION}.bin filaman_full_${VERSION}.bin; do
fi if [ -f "$file" ]; then
echo "Uploading $file..."
# Create release with available files curl -L \
if [ -n "$FILES_TO_UPLOAD" ]; then -X POST \
gh release create "v${VERSION}" \ -H "Accept: application/vnd.github+json" \
--title "Release ${VERSION}" \ -H "Authorization: Bearer $GITHUB_TOKEN" \
--notes "${{ steps.changelog.outputs.CHANGES }}" \ -H "X-GitHub-Api-Version: 2022-11-28" \
$FILES_TO_UPLOAD -H "Content-Type: application/octet-stream" \
else "${UPLOAD_URL}?name=${file}" \
echo "Error: No files found to upload" --data-binary "@${file}"
exit 1 fi
fi done

View File

@ -5,66 +5,35 @@ on:
tags: tags:
- 'v*' - 'v*'
permissions:
contents: write
jobs: jobs:
route: detect-provider:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
provider: ${{ steps.provider.outputs.provider }} provider: ${{ steps.provider.outputs.provider }}
gitea_ref_name: ${{ steps.provider.outputs.gitea_ref_name }}
gitea_server_url: ${{ steps.provider.outputs.gitea_server_url }}
gitea_repository: ${{ steps.provider.outputs.gitea_repository }}
steps: steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Debug Environment
run: |
echo "CI Environment Details:"
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 - name: Determine CI Provider
id: provider id: provider
shell: bash shell: bash
run: | run: |
if [ -n "${GITEA_ACTIONS}" ] || [ -n "${GITEA_REPOSITORY}" ] || [[ "${RUNNER_NAME}" == *"gitea"* ]]; then if [ -n "${GITEA_ACTIONS}" ] || [ -n "${GITEA_REPOSITORY}" ] || [[ "${RUNNER_NAME}" == *"gitea"* ]]; then
echo "provider=gitea" >> "$GITHUB_OUTPUT" echo "provider=gitea" >> "$GITHUB_OUTPUT"
echo "gitea_ref_name=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
echo "gitea_server_url=${GITHUB_SERVER_URL}" >> "$GITHUB_OUTPUT"
echo "gitea_repository=${GITHUB_REPOSITORY}" >> "$GITHUB_OUTPUT"
elif [ "${GITHUB_ACTIONS}" = "true" ]; then
echo "provider=github" >> "$GITHUB_OUTPUT"
else else
echo "provider=unknown" >> "$GITHUB_OUTPUT" echo "provider=github" >> "$GITHUB_OUTPUT"
fi
verify-provider:
needs: route
runs-on: ubuntu-latest
steps:
- name: Echo detected provider
run: |
echo "Detected CI Provider: ${{ needs.route.outputs.provider }}"
if [ "${{ needs.route.outputs.provider }}" = "unknown" ]; then
echo "::error::Failed to detect CI provider!"
exit 1
fi fi
github-release: github-release:
needs: [route, verify-provider] needs: detect-provider
if: needs.route.outputs.provider == 'github' permissions:
contents: write
if: needs.detect-provider.outputs.provider == 'github'
uses: ./.github/workflows/github-release.yml uses: ./.github/workflows/github-release.yml
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
gitea-release: gitea-release:
needs: [route, verify-provider] needs: detect-provider
if: needs.route.outputs.provider == 'gitea' if: needs.detect-provider.outputs.provider == 'gitea'
uses: ./.github/workflows/gitea-release.yml uses: ./.github/workflows/gitea-release.yml
with:
gitea_ref_name: ${{ needs.route.outputs.gitea_ref_name }}
gitea_server_url: ${{ needs.route.outputs.gitea_server_url }}
gitea_repository: ${{ needs.route.outputs.gitea_repository }}
secrets:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}

View File

@ -1,5 +1,23 @@
# Changelog # Changelog
## [1.3.12] - 2025-02-21
### Changed
- update webpages for version v1.3.12
- ci: enhance GitHub release workflow with token handling and file upload improvements
## [1.3.11] - 2025-02-21
### Changed
- update webpages for version v1.3.11
- ci: refactor Gitea release workflow by simplifying input handling and removing unnecessary checks
## [1.3.10] - 2025-02-21
### Changed
- update webpages for version v1.3.10
- ci: simplify GitHub release workflow by removing provider verification step
## [1.3.9] - 2025-02-21 ## [1.3.9] - 2025-02-21
### Changed ### Changed
- update webpages for version v1.3.9 - update webpages for version v1.3.9

View File

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