Compare commits

...

14 Commits

Author SHA1 Message Date
5e66c3bd45 docs: update changelog for version 1.2.19
Some checks failed
Release / prepare (push) Has been cancelled
Release / github (push) Has been cancelled
Release / gitea (push) Has been cancelled
2025-02-19 01:19:46 +01:00
61c82f796f feat: add Gitea and GitHub release workflows for version 1.2.19 2025-02-19 01:19:42 +01:00
7661e0eb20 docs: update changelog for version 1.2.18
Some checks failed
Release / release (push) Has been cancelled
2025-02-19 01:18:00 +01:00
c06e6de89a feat: remove Gitea and GitHub release workflows and increment version to 1.2.18 2025-02-19 01:17:56 +01:00
262bed84df docs: update changelog for version 1.2.17
Some checks failed
Release / prepare (push) Has been cancelled
Release / github (push) Has been cancelled
Release / gitea (push) Has been cancelled
2025-02-19 01:03:56 +01:00
c710e5d7f8 feat: update Gitea release workflow for version 1.2.17 and improve job structure 2025-02-19 01:03:53 +01:00
5d39f04786 docs: update changelog for version 1.2.16
Some checks failed
Release / github-release (push) Has been cancelled
Release / gitea-release (push) Has been cancelled
Release / get-version-and-changelog (push) Has been cancelled
2025-02-19 00:49:39 +01:00
d955e26b82 feat: update Gitea release workflow and increment version to 1.2.16 2025-02-19 00:49:35 +01:00
c20e7de5c3 docs: update changelog for version 1.2.15
Some checks failed
Release / get-version-and-changelog (push) Successful in 7s
Release / github-release (push) Has been skipped
Release / gitea-release (push) Failing after 2s
2025-02-19 00:46:38 +01:00
55c3b3688a feat: update version to 1.2.15 and clean up Gitea release workflow 2025-02-19 00:46:34 +01:00
fea5932125 docs: update changelog for version 1.2.14
Some checks failed
Release / get-version-and-changelog (push) Successful in 8s
Release / github-release (push) Has been skipped
Release / gitea-release (push) Failing after 3s
2025-02-19 00:43:18 +01:00
04f557939d feat: update version to 1.2.14 and refactor release workflows for improved GitHub and Gitea support 2025-02-19 00:43:15 +01:00
58549a53e4 docs: update changelog for version 1.2.13 2025-02-19 00:32:43 +01:00
64a46e3e7d feat: update version to 1.2.13 and enhance release workflow with Python setup and Gitea support 2025-02-19 00:32:40 +01:00
5 changed files with 157 additions and 147 deletions

View File

@ -4,115 +4,60 @@ on:
workflow_call: workflow_call:
inputs: inputs:
version: version:
required: true
type: string type: string
required: true
changelog: changelog:
required: true
type: string type: string
required: true
permissions:
contents: write # Required for creating releases
issues: read # Required for reading changelog
pull-requests: read # Required for reading changelog
jobs: jobs:
build: release:
runs-on: ubuntu-latest runs-on: gitea-runner
permissions:
contents: write
steps: steps:
- uses: actions/checkout@v4 - name: Debug Info
run: |
- name: Set up Python echo "Version: ${{ inputs.version }}"
uses: actions/setup-python@v4 echo "Changelog: ${{ inputs.changelog }}"
with: echo "Tag: ${GITHUB_REF#refs/tags/}"
python-version: '3.x'
- uses: actions/checkout@v4
- name: Install dependencies
run: | - name: Set up Python
python -m pip install --upgrade pip uses: actions/setup-python@v4
pip install --upgrade platformio esptool with:
sudo apt-get update python-version: '3.x'
sudo apt-get install -y jq
- name: Install dependencies
- name: Build Firmware run: |
run: | python -m pip install --upgrade pip
pio run -t buildfs pip install platformio esptool
pio run
- name: Build
- name: Merge firmware and SPIFFS run: |
run: | pio run -t buildfs
esptool.py --chip esp32 merge_bin \ pio run
--flash_mode dio \
--flash_freq 40m \ - name: Create full firmware
--flash_size 4MB \ run: |
-o .pio/build/esp32dev/filaman_full.bin \ esptool.py --chip esp32 merge_bin \
0x1000 .pio/build/esp32dev/bootloader.bin \ --flash_mode dio \
0x8000 .pio/build/esp32dev/partitions.bin \ --flash_freq 40m \
0x10000 .pio/build/esp32dev/firmware.bin \ --flash_size 4MB \
0x290000 .pio/build/esp32dev/spiffs.bin -o .pio/build/esp32dev/filaman_full.bin \
0x1000 .pio/build/esp32dev/bootloader.bin \
- name: Prepare OTA firmware 0x8000 .pio/build/esp32dev/partitions.bin \
run: cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_ota.bin 0x10000 .pio/build/esp32dev/firmware.bin \
0x290000 .pio/build/esp32dev/spiffs.bin
- name: Create Release cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_ota.bin
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} - name: Create Release
GITEA_API_URL: ${{ secrets.GITEA_API_URL }} run: |
GITEA_REPOSITORY: ${{ secrets.GITEA_REPOSITORY }} TAG="${GITHUB_REF#refs/tags/}"
run: | curl -X POST "${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases" \
# Validate and sanitize API URL
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 "Content-Type: application/json" \
-H "Accept: application/json" \
"${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases" \
-d @- << EOF
{
"tag_name": "${{ github.ref_name }}",
"name": "Release ${{ inputs.version }}",
"body": ${{ toJSON(inputs.changelog) }},
"draft": false,
"prerelease": false
}
EOF
)
# Extract and validate release 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 binary files
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/json" \
"${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${file}" \ -d "{\"tag_name\":\"$TAG\",\"name\":\"Release ${{ inputs.version }}\",\"body\":\"${{ inputs.changelog }}\",\"draft\":false,\"prerelease\":false}"
--data-binary "@.pio/build/esp32dev/${file}"; then env:
echo "Error: Failed to upload $file" GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
exit 1 GITEA_API_URL: ${{ secrets.GITEA_API_URL }}
fi GITEA_REPOSITORY: ${{ secrets.GITEA_REPOSITORY }}
echo "Successfully uploaded $file"
done
}
}
}
}

View File

@ -11,15 +11,11 @@ on:
type: string type: string
permissions: permissions:
contents: write # Required for creating releases contents: write
issues: read # Required for reading changelog
pull-requests: read # Required for reading changelog
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: write # Required for creating releases at job level
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -35,8 +31,8 @@ jobs:
- 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: Merge firmware and SPIFFS - name: Merge firmware and SPIFFS
run: | run: |
@ -53,7 +49,7 @@ jobs:
- name: Prepare OTA firmware - name: Prepare OTA firmware
run: cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_ota.bin run: cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_ota.bin
- name: Create Release - name: Create GitHub Release
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |

View File

@ -7,51 +7,85 @@ on:
jobs: jobs:
prepare: prepare:
runs-on: ubuntu-latest runs-on: gitea-runner
outputs: outputs:
version: ${{ steps.get_version.outputs.VERSION }} version: ${{ steps.version.outputs.version }}
changelog: ${{ steps.changelog.outputs.CHANGES }} changelog: ${{ steps.changelog.outputs.changelog }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Get version from tag - name: Get version from tag
id: get_version id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Verify version match
run: | run: |
PIO_VERSION=$(grep '^version = ' platformio.ini | cut -d'"' -f2) VERSION=${GITHUB_REF#refs/tags/v}
TAG_VERSION=${{ steps.get_version.outputs.VERSION }} echo "version=$VERSION" >> $GITHUB_OUTPUT
if [ "$PIO_VERSION" != "$TAG_VERSION" ]; then
echo "Error: Version mismatch between tag ($TAG_VERSION) and platformio.ini ($PIO_VERSION)"
exit 1
fi
- name: Read CHANGELOG.md - name: Get changelog
id: changelog id: changelog
run: | run: |
CHANGELOG=$(awk "/## \\[${{ steps.get_version.outputs.VERSION }}\\]/{p=1;print;next} /## \\[/{p=0} p" CHANGELOG.md) CHANGELOG=$(awk "/## \\[${{ steps.version.outputs.version }}\\]/{p=1;print;next} /## \\[/{p=0} p" CHANGELOG.md)
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT
- name: Determine provider github:
id: detect-provider
run: |
if [[ "$GITHUB_SERVER_URL" == "https://github.com" ]]; then
echo "provider=github" >> $GITHUB_OUTPUT
else
echo "provider=gitea" >> $GITHUB_OUTPUT
fi
release:
needs: prepare needs: prepare
runs-on: ubuntu-latest if: github.server_url == 'https://github.com'
uses: ./.github/workflows/providers/github-release.yml
with:
version: ${{ needs.prepare.outputs.version }}
changelog: ${{ needs.prepare.outputs.changelog }}
secrets: inherit
gitea:
needs: prepare
if: github.server_url != 'https://github.com'
runs-on: gitea-runner
steps: steps:
- name: Run provider workflow - uses: actions/checkout@v4
uses: ./.github/workflows/providers/${{ needs.prepare.outputs.provider == 'github' && 'github' || 'gitea' }}-release.yml
- name: Set up Python
uses: actions/setup-python@v4
with: with:
version: ${{ needs.prepare.outputs.version }} python-version: '3.x'
changelog: ${{ needs.prepare.outputs.changelog }}
secrets: inherit - name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install platformio esptool
- name: Build
run: |
pio run -t buildfs
pio run
- name: Create full firmware
run: |
esptool.py --chip esp32 merge_bin \
--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
cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_ota.bin
- name: Create Release
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_API_URL: ${{ secrets.GITEA_API_URL }}
GITEA_REPOSITORY: ${{ secrets.GITEA_REPOSITORY }}
run: |
echo "Creating release for version ${{ needs.prepare.outputs.version }}"
curl -X POST "${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{
\"tag_name\": \"${GITHUB_REF#refs/tags/}\",
\"name\": \"Release ${{ needs.prepare.outputs.version }}\",
\"body\": \"${{ needs.prepare.outputs.changelog }}\",
\"draft\": false,
\"prerelease\": false
}"

View File

@ -1,5 +1,40 @@
# Changelog # Changelog
## [1.2.19] - 2025-02-19
### Added
- add Gitea and GitHub release workflows for version 1.2.19
## [1.2.18] - 2025-02-19
### Added
- remove Gitea and GitHub release workflows and increment version to 1.2.18
## [1.2.17] - 2025-02-19
### Added
- update Gitea release workflow for version 1.2.17 and improve job structure
## [1.2.16] - 2025-02-19
### Added
- update Gitea release workflow and increment version to 1.2.16
## [1.2.15] - 2025-02-19
### Added
- update version to 1.2.15 and clean up Gitea release workflow
## [1.2.14] - 2025-02-19
### Added
- update version to 1.2.14 and refactor release workflows for improved GitHub and Gitea support
## [1.2.13] - 2025-02-19
### Added
- update version to 1.2.13 and enhance release workflow with Python setup and Gitea support
## [1.2.12] - 2025-02-19 ## [1.2.12] - 2025-02-19
### Added ### Added
- update version to 1.2.12 and refactor release workflows for improved provider detection and execution - update version to 1.2.12 and refactor release workflows for improved provider detection and execution

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.12" version = "1.2.19"
[env:esp32dev] [env:esp32dev]
platform = espressif32 platform = espressif32