Compare commits

...

9 Commits

Author SHA1 Message Date
c2bd0982ab docs: update changelog for version 1.2.12
Some checks failed
Release / prepare (push) Successful in 8s
Release / release (push) Failing after 0s
2025-02-19 00:26:45 +01:00
e0b8da079e feat: update version to 1.2.12 and refactor release workflows for improved provider detection and execution 2025-02-19 00:26:40 +01:00
8c88827a2d docs: update changelog for version 1.2.11
Some checks failed
Release / prepare (push) Successful in 8s
Release / github-release (push) Has been skipped
Release / gitea-release (push) Failing after 3s
2025-02-18 23:50:00 +01:00
6128bc2827 feat: update version to 1.2.11 and enhance GitHub and Gitea release workflows with input validation and improved error handling 2025-02-18 23:49:57 +01:00
6d21a8ec52 docs: update changelog for version 1.2.10 2025-02-18 23:31:16 +01:00
2ee4eca7dd feat: enhance Gitea release workflow with API connection verification and URL validation; update version to 1.2.10 2025-02-18 23:31:00 +01:00
9eb64e06f0 docs: update changelog for version 1.2.9
Some checks failed
Release / release (push) Failing after 2m37s
2025-02-18 23:20:06 +01:00
693ef4e26c feat: update version to 1.2.9 in platformio.ini 2025-02-18 23:20:03 +01:00
11c099eba2 feat: refactor GitHub and Gitea release workflows for improved version handling and firmware uploads 2025-02-18 23:14:52 +01:00
6 changed files with 161 additions and 102 deletions

View File

@ -1,7 +1,14 @@
name: Gitea Release name: Gitea Release
on: on:
workflow_call: # This workflow will only be triggered when called by another workflow workflow_call:
inputs:
version:
required: true
type: string
changelog:
required: true
type: string
permissions: permissions:
contents: write # Required for creating releases contents: write # Required for creating releases
@ -21,19 +28,17 @@ jobs:
with: with:
python-version: '3.x' python-version: '3.x'
- name: Install PlatformIO - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install --upgrade platformio pip install --upgrade platformio esptool
sudo apt-get update
sudo apt-get install -y jq
- name: Build Firmware - name: Build Firmware
run: | run: |
pio run -t buildfs # Build SPIFFS pio run -t buildfs
pio run # Build firmware pio run
- name: Install esptool
run: |
pip install esptool
- name: Merge firmware and SPIFFS - name: Merge firmware and SPIFFS
run: | run: |
@ -48,20 +53,7 @@ jobs:
0x290000 .pio/build/esp32dev/spiffs.bin 0x290000 .pio/build/esp32dev/spiffs.bin
- name: Prepare OTA firmware - name: Prepare OTA firmware
run: | run: cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_ota.bin
cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_ota.bin
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Read CHANGELOG.md
id: changelog
run: |
CHANGELOG=$(awk "/## \\[${{ steps.get_version.outputs.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 - name: Create Release
env: env:
@ -69,33 +61,58 @@ jobs:
GITEA_API_URL: ${{ secrets.GITEA_API_URL }} GITEA_API_URL: ${{ secrets.GITEA_API_URL }}
GITEA_REPOSITORY: ${{ secrets.GITEA_REPOSITORY }} GITEA_REPOSITORY: ${{ secrets.GITEA_REPOSITORY }}
run: | run: |
# Create release using Gitea API # Validate and sanitize API URL
RESPONSE=$(curl -X POST \ if [[ ! "$GITEA_API_URL" =~ ^https?:// ]]; then
echo "Error: GITEA_API_URL must start with http:// or https://"
exit 1
fi
# Remove trailing slash and ensure /api/v1
GITEA_API_URL="${GITEA_API_URL%/}"
if [[ ! "$GITEA_API_URL" =~ /api/v1$ ]]; then
GITEA_API_URL="${GITEA_API_URL}/api/v1"
fi
echo "Creating Gitea release..."
RESPONSE=$(curl -sS -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-H "accept: application/json" \ -H "Accept: application/json" \
"${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases" \ "${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases" \
-d '{ -d @- << EOF
{
"tag_name": "${{ github.ref_name }}", "tag_name": "${{ github.ref_name }}",
"name": "Release ${{ steps.get_version.outputs.VERSION }}", "name": "Release ${{ inputs.version }}",
"body": "${{ steps.changelog.outputs.CHANGES }}", "body": ${{ toJSON(inputs.changelog) }},
"draft": false, "draft": false,
"prerelease": false "prerelease": false
}') }
EOF
)
# Extract release ID from response # Extract and validate release ID
RELEASE_ID=$(echo $RESPONSE | jq -r .id) RELEASE_ID=$(echo "$RESPONSE" | jq -r .id)
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
echo "Error: Failed to get release ID"
echo "API Response:"
echo "$RESPONSE" | jq .
exit 1
fi
# Upload full firmware # Upload binary files
curl -X POST \ for file in "filaman_full.bin" "filaman_ota.bin"; do
echo "Uploading $file..."
if ! curl -sS -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/octet-stream" \ -H "Content-Type: application/octet-stream" \
"${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases/${RELEASE_ID}/assets?name=filaman_full.bin" \ "${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${file}" \
--data-binary @.pio/build/esp32dev/filaman_full.bin --data-binary "@.pio/build/esp32dev/${file}"; then
echo "Error: Failed to upload $file"
# Upload OTA firmware exit 1
curl -X POST \ fi
-H "Authorization: token ${GITEA_TOKEN}" \ echo "Successfully uploaded $file"
-H "Content-Type: application/octet-stream" \ done
"${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases/${RELEASE_ID}/assets?name=filaman_ota.bin" \ }
--data-binary @.pio/build/esp32dev/filaman_ota.bin }
}
}

View File

@ -1,9 +1,14 @@
name: GitHub Release name: GitHub Release
on: on:
push: workflow_call:
tags: inputs:
- 'v*' version:
required: true
type: string
changelog:
required: true
type: string
permissions: permissions:
contents: write # Required for creating releases contents: write # Required for creating releases
@ -23,20 +28,16 @@ jobs:
with: with:
python-version: '3.x' python-version: '3.x'
- name: Install PlatformIO - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install --upgrade platformio pip install --upgrade platformio esptool
- name: Build Firmware - name: Build Firmware
run: | run: |
pio run -t buildfs # Build SPIFFS pio run -t buildfs # Build SPIFFS
pio run # Build firmware pio run # Build firmware
- name: Install esptool
run: |
pip install esptool
- name: Merge firmware and SPIFFS - name: Merge firmware and SPIFFS
run: | run: |
esptool.py --chip esp32 merge_bin \ esptool.py --chip esp32 merge_bin \
@ -50,36 +51,14 @@ jobs:
0x290000 .pio/build/esp32dev/spiffs.bin 0x290000 .pio/build/esp32dev/spiffs.bin
- name: Prepare OTA firmware - name: Prepare OTA firmware
run: | run: cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_ota.bin
# Use PlatformIO to create a proper OTA image
cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_ota.bin
- name: Get version from tag - name: Create Release
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Read CHANGELOG.md
id: changelog
run: |
CHANGELOG=$(awk "/## \\[${{ steps.get_version.outputs.VERSION }}\\]/{p=1;print;next} /## \\[/{p=0} p" CHANGELOG.md)
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Install and Configure GitHub CLI
run: |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
- name: Create Release with GitHub CLI
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
gh release create "${{ github.ref_name }}" \ gh release create "${{ github.ref_name }}" \
--title "Release ${{ steps.get_version.outputs.VERSION }}" \ --title "Release ${{ inputs.version }}" \
--notes "${{ steps.changelog.outputs.CHANGES }}" \ --notes "${{ inputs.changelog }}" \
".pio/build/esp32dev/filaman_full.bin#filaman_full.bin" \ ".pio/build/esp32dev/filaman_full.bin#filaman_full.bin" \
".pio/build/esp32dev/filaman_ota.bin#filaman_ota.bin" ".pio/build/esp32dev/filaman_ota.bin#filaman_ota.bin"

View File

@ -6,28 +6,52 @@ on:
- 'v*' - 'v*'
jobs: jobs:
detect: prepare:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
platform: ${{ steps.platform.outputs.platform }} version: ${{ steps.get_version.outputs.VERSION }}
changelog: ${{ steps.changelog.outputs.CHANGES }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Determine hosting platform - name: Get version from tag
id: platform id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Verify version match
run: | run: |
if [[ "$GITHUB_SERVER_URL" == "https://github.com" ]]; then PIO_VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2)
echo "platform=github" >> $GITHUB_OUTPUT TAG_VERSION=${{ steps.get_version.outputs.VERSION }}
else
echo "platform=gitea" >> $GITHUB_OUTPUT if [ "$PIO_VERSION" != "$TAG_VERSION" ]; then
echo "Error: Version mismatch between tag ($TAG_VERSION) and platformio.ini ($PIO_VERSION)"
exit 1
fi fi
gitea-release: - name: Read CHANGELOG.md
needs: detect id: changelog
if: needs.detect.outputs.platform == 'gitea' run: |
uses: ./.github/workflows/providers/gitea-release.yml CHANGELOG=$(awk "/## \\[${{ steps.get_version.outputs.VERSION }}\\]/{p=1;print;next} /## \\[/{p=0} p" CHANGELOG.md)
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
github-release: - name: Determine provider
needs: detect id: detect-provider
if: needs.detect.outputs.platform == 'github' run: |
uses: ./.github/workflows/providers/github-release.yml if [[ "$GITHUB_SERVER_URL" == "https://github.com" ]]; then
echo "provider=github" >> $GITHUB_OUTPUT
else
echo "provider=gitea" >> $GITHUB_OUTPUT
fi
release:
needs: prepare
runs-on: ubuntu-latest
steps:
- name: Run provider workflow
uses: ./.github/workflows/providers/${{ needs.prepare.outputs.provider == 'github' && 'github' || 'gitea' }}-release.yml
with:
version: ${{ needs.prepare.outputs.version }}
changelog: ${{ needs.prepare.outputs.changelog }}
secrets: inherit

View File

@ -1,5 +1,26 @@
# Changelog # Changelog
## [1.2.12] - 2025-02-19
### Added
- update version to 1.2.12 and refactor release workflows for improved provider detection and execution
## [1.2.11] - 2025-02-18
### Added
- update version to 1.2.11 and enhance GitHub and Gitea release workflows with input validation and improved error handling
## [1.2.10] - 2025-02-18
### Added
- enhance Gitea release workflow with API connection verification and URL validation; update version to 1.2.10
## [1.2.9] - 2025-02-18
### Added
- update version to 1.2.9 in platformio.ini
- refactor GitHub and Gitea release workflows for improved version handling and firmware uploads
## [1.2.8] - 2025-02-18 ## [1.2.8] - 2025-02-18
### Added ### Added
- update version to 1.2.8 in platformio.ini; refactor Gitea and GitHub release workflows - update version to 1.2.8 in platformio.ini; refactor Gitea and GitHub release workflows

View File

@ -124,6 +124,24 @@ german explanatory video: [Youtube](https://youtu.be/uNDe2wh9SS8?si=b-jYx4I1w62z
- Configure WiFi settings through the captive portal. - Configure WiFi settings through the captive portal.
- Access the web interface at `http://filaman.local` or the IP address. - Access the web interface at `http://filaman.local` or the IP address.
## GitHub Actions Configuration
### Required Secrets for Gitea Releases
When using Gitea as your repository host, you need to configure the following secrets in your repository:
- `GITEA_API_URL`: The base URL of your Gitea instance, including protocol (e.g., `https://git.example.com`)
- `GITEA_TOKEN`: Your Gitea access token with permissions to create releases
- `GITEA_REPOSITORY`: The repository name in format `owner/repo` (e.g., `username/filaman`)
Example values:
```
GITEA_API_URL=https://git.example.com
GITEA_TOKEN=abcdef1234567890
GITEA_REPOSITORY=username/filaman
```
Make sure to set these secrets in your repository settings under Settings > Secrets and Variables > Actions.
## Documentation ## Documentation

View File

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