Compare commits

..

2 Commits

5 changed files with 27 additions and 148 deletions

View File

@@ -1,7 +1,9 @@
name: Gitea Release name: Gitea Release
on: on:
workflow_call: # This workflow will only be triggered when called by another workflow push:
tags:
- 'v*'
permissions: permissions:
contents: write # Required for creating releases contents: write # Required for creating releases
@@ -64,11 +66,11 @@ jobs:
echo "EOF" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release - name: Create Release
env: env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
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 # Create release using Gitea API
RESPONSE=$(curl -X POST \ RESPONSE=$(curl -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \

View File

@@ -1,7 +1,9 @@
name: GitHub Release name: GitHub Release
on: on:
workflow_call: # This workflow will only be triggered when called by another workflow push:
tags:
- 'v*'
permissions: permissions:
contents: write # Required for creating releases contents: write # Required for creating releases

View File

@@ -6,126 +6,27 @@ on:
- 'v*' - 'v*'
jobs: jobs:
release: detect-and-run:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Build Firmware
run: |
pio run -t buildfs # Build SPIFFS
pio run # Build firmware
- name: Install esptool
run: |
pip install esptool
- name: Merge firmware and SPIFFS
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
- name: Prepare OTA firmware - name: Determine hosting platform
run: | id: platform
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: Install jq
if: ${{ github.server_url != 'https://github.com' }}
run: sudo apt-get install -y jq
- name: Determine and run release process
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_API_URL: ${{ secrets.GITEA_API_URL }}
GITEA_REPOSITORY: ${{ secrets.GITEA_REPOSITORY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
if [[ "$GITHUB_SERVER_URL" == "https://github.com" ]]; then if [[ "$GITHUB_SERVER_URL" == "https://github.com" ]]; then
echo "Creating GitHub Release..." echo "platform=github" >> $GITHUB_OUTPUT
curl -X POST \ elif [[ "$CI_SERVER_URL" == *"gitlab"* ]]; then
-H "Authorization: token ${GITHUB_TOKEN}" \ echo "platform=gitlab" >> $GITHUB_OUTPUT
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases \
-d '{
"tag_name": "${{ github.ref_name }}",
"name": "Release ${{ steps.get_version.outputs.VERSION }}",
"body": "${{ steps.changelog.outputs.CHANGES }}",
"draft": false,
"prerelease": false
}' > release.json
UPLOAD_URL=$(jq -r .upload_url release.json | sed 's/{?name,label}//')
# Upload full firmware
curl -X POST \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H "Content-Type: application/octet-stream" \
"${UPLOAD_URL}?name=filaman_full.bin" \
--data-binary @.pio/build/esp32dev/filaman_full.bin
# Upload OTA firmware
curl -X POST \
-H "Authorization: token ${GITHUB_TOKEN}" \
-H "Content-Type: application/octet-stream" \
"${UPLOAD_URL}?name=filaman_ota.bin" \
--data-binary @.pio/build/esp32dev/filaman_ota.bin
else else
echo "Creating Gitea Release..." echo "platform=gitea" >> $GITHUB_OUTPUT
RESPONSE=$(curl -X POST \ fi
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ - name: Run GitHub Release
-H "accept: application/json" \ if: steps.platform.outputs.platform == 'github'
"${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases" \ uses: ./.github/workflows/providers/github-release.yml
-d '{
"tag_name": "${{ github.ref_name }}", - name: Run Gitea Release
"name": "Release ${{ steps.get_version.outputs.VERSION }}", if: steps.platform.outputs.platform == 'gitea'
"body": "${{ steps.changelog.outputs.CHANGES }}", uses: ./.github/workflows/providers/gitea-release.yml
"draft": false,
"prerelease": false
}')
RELEASE_ID=$(echo $RESPONSE | jq -r .id)
# Upload full firmware
curl -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/octet-stream" \
"${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases/${RELEASE_ID}/assets?name=filaman_full.bin" \
--data-binary @.pio/build/esp32dev/filaman_full.bin
# Upload OTA firmware
curl -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/octet-stream" \
"${GITEA_API_URL}/repos/${GITEA_REPOSITORY}/releases/${RELEASE_ID}/assets?name=filaman_ota.bin" \
--data-binary @.pio/build/esp32dev/filaman_ota.bin
fi

View File

@@ -1,31 +1,5 @@
# Changelog # Changelog
## [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
### Added
- update version to 1.2.8 in platformio.ini; refactor Gitea and GitHub release workflows
- update version to 1.2.7 in platformio.ini; adjust Gitea release workflow
## [1.2.6] - 2025-02-18
### Added
- update version to 1.2.6 in platformio.ini
- update version to 1.2.5; enhance Gitea release workflow and streamline release process
### Changed
- update changelog for version 1.2.5
## [1.2.5] - 2025-02-18
### Added
- update version to 1.2.5; enhance Gitea release workflow and streamline release process
## [1.2.4] - 2025-02-18 ## [1.2.4] - 2025-02-18
### Added ### Added
- update version to 1.2.4 in HTML files and platformio.ini - update version to 1.2.4 in HTML files and platformio.ini

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