@@ -18,3 +18,74 @@ jobs:
|
||||
with:
|
||||
esp_idf_version: v6.0.2
|
||||
target: esp32c6
|
||||
|
||||
- name: Package firmware
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
set -euo pipefail
|
||||
NAME="firmware-${GITHUB_REF_NAME}"
|
||||
mkdir -p "release/${NAME}/build/bootloader" "release/${NAME}/build/partition_table"
|
||||
|
||||
# Keep the build/ layout so "@flash_args" works after unzipping
|
||||
cp build/bootloader/bootloader.bin "release/${NAME}/build/bootloader/"
|
||||
cp build/partition_table/partition-table.bin "release/${NAME}/build/partition_table/"
|
||||
cp "build/${PROJECT_BIN}" "release/${NAME}/build/"
|
||||
cp build/flash_args "release/${NAME}/build/"
|
||||
(cd release && zip -qr "${NAME}.zip" "${NAME}")
|
||||
|
||||
# Standalone copies
|
||||
cp build/bootloader/bootloader.bin release/
|
||||
cp build/partition_table/partition-table.bin release/
|
||||
cp "build/${PROJECT_BIN}" release/
|
||||
|
||||
cat > release/notes.md <<EOF
|
||||
## Flashing (${CHIP})
|
||||
|
||||
Requires [esptool](https://github.com/espressif/esptool) (\`pip install esptool\`).
|
||||
|
||||
**Option 1: with the individual files**
|
||||
|
||||
\`\`\`
|
||||
python -m esptool --chip ${CHIP} -b 460800 --before default-reset --after hard-reset write-flash --flash-mode dio --flash-size 4MB --flash-freq 80m 0x0 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/${PROJECT_BIN}
|
||||
\`\`\`
|
||||
|
||||
**Option 2: unzip \`${NAME}.zip\`, then from inside its \`build\` directory**
|
||||
|
||||
\`\`\`
|
||||
python -m esptool --chip ${CHIP} -b 460800 --before default-reset --after hard-reset write-flash "@flash_args"
|
||||
\`\`\`
|
||||
EOF
|
||||
|
||||
- name: Create release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref_name }}
|
||||
body_path: release/notes.md
|
||||
draft: false
|
||||
prerelease: true
|
||||
|
||||
# actions/upload-release-asset relies on GitHub's templated upload_url, which Gitea
|
||||
# doesn't provide, so attach the files through Gitea's API. The release ID is looked
|
||||
# up by tag rather than taken from the step's outputs, because the old toolkit inside
|
||||
# actions/create-release may emit outputs in a format Gitea's runner doesn't parse.
|
||||
- name: Upload release assets
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
API="${GITHUB_API_URL:-${GITHUB_SERVER_URL}/api/v1}/repos/${GITHUB_REPOSITORY}"
|
||||
|
||||
RELEASE_ID=$(curl -fsS -H "Authorization: token ${TOKEN}" \
|
||||
"${API}/releases/tags/${GITHUB_REF_NAME}" | jq -r .id)
|
||||
|
||||
for f in release/firmware-*.zip release/bootloader.bin release/partition-table.bin "release/${PROJECT_BIN}"; do
|
||||
echo "Uploading $(basename "$f")"
|
||||
curl -fsS -X POST "${API}/releases/${RELEASE_ID}/assets?name=$(basename "$f")" \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-F "attachment=@${f}" >/dev/null
|
||||
done
|
||||
Reference in New Issue
Block a user