[YAML] add metadata to the artifact file name
Dieser Commit ist enthalten in:
1 Ursprung
670c00ef70
Commit
b17fc21aa0
1 Datei geändert
+47
-30
@@ -27,13 +27,28 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
ref: ${{ github.event.inputs.target_branch || github.ref }}
|
ref: ${{ github.event.inputs.target_branch || github.ref }}
|
||||||
|
|
||||||
# 2. Set up Python environment
|
# 2. Extract Git and Date Metadata for the dynamic artifact filename
|
||||||
|
- name: Generate Dynamic Artifact Metadata
|
||||||
|
id: meta
|
||||||
|
run: |
|
||||||
|
# Get current date in YYYYMMDD format
|
||||||
|
echo "CURRENT_DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Get short 7-character git commit hash
|
||||||
|
echo "GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Extract and sanitize branch name (replace slashes and special characters with dashes)
|
||||||
|
RAW_BRANCH=${{ github.event.inputs.target_branch || github.ref_name }}
|
||||||
|
CLEAN_BRANCH=$(echo "$RAW_BRANCH" | sed 's/[^a-zA-Z0-9.\-]/_§/g' | sed 's|§|-|g' | sed 's|_||g')
|
||||||
|
echo "GIT_BRANCH=$CLEAN_BRANCH" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# 3. Set up Python environment
|
||||||
- name: Set up Python 3.x
|
- name: Set up Python 3.x
|
||||||
uses: actions/setup-python@v7
|
uses: actions/setup-python@v7
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
|
|
||||||
# 3. Cache global PlatformIO directories, uses a dynamic key based on platformio.ini
|
# 4. Cache global PlatformIO directories, uses a dynamic key based on platformio.ini
|
||||||
- name: Cache PlatformIO
|
- name: Cache PlatformIO
|
||||||
uses: actions/cache@v6
|
uses: actions/cache@v6
|
||||||
with:
|
with:
|
||||||
@@ -45,17 +60,19 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-pio-
|
${{ runner.os }}-pio-
|
||||||
|
|
||||||
# 4. Install PlatformIO Core and the required intelhex extension in a single, quiet command
|
# 5. Install PlatformIO Core and the required intelhex extension in a single, quiet command
|
||||||
- name: Install PlatformIO Core
|
- name: Install PlatformIO Core
|
||||||
run: python -m pip install --quiet --upgrade pip platformio intelhex
|
run: python -m pip install --quiet --upgrade pip platformio intelhex
|
||||||
|
|
||||||
|
# 6. Install ESP32 Platform SDK
|
||||||
- name: Install ESP32 platform
|
- name: Install ESP32 platform
|
||||||
run: pio pkg install --silent --global --platform espressif32
|
run: pio pkg install --silent --global --platform espressif32
|
||||||
|
|
||||||
|
# 7. Compile the Project
|
||||||
- name: Compile the Project
|
- name: Compile the Project
|
||||||
run: pio run
|
run: pio run
|
||||||
|
|
||||||
# 11. Dynamically create the smart flashing scripts next to the T-Beam binary
|
# 8. Dynamically create the smart flashing scripts next to the T-Beam binary
|
||||||
# with optional bootloader detection and group check
|
# with optional bootloader detection and group check
|
||||||
# the table of flash addresses usually found at /partitions-4MB-safeboot.csv
|
# the table of flash addresses usually found at /partitions-4MB-safeboot.csv
|
||||||
- name: Create Desktop Flashing Scripts
|
- name: Create Desktop Flashing Scripts
|
||||||
@@ -79,12 +96,12 @@ jobs:
|
|||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
|
|
||||||
echo -e "${YELLOW}=== MeshCom Universal ESP32 Flashing Script ===${NC}"
|
echo -e "${YELLOW}=== FoxMesh Universal ESP32 Flashing Script ===${NC}"
|
||||||
|
|
||||||
if ! command -v esptool &> /dev/null; then
|
if ! command -v esptool &> /dev/null; then
|
||||||
echo -e "${RED}Error: esptool is not installed.${NC}"
|
echo -e "${RED}Error: esptool is not installed.${NC}"
|
||||||
echo "Please install it via your package manager or pip: 'pip install esptool'"
|
echo "Please install it via your package manager or pip: 'pip install esptool'"
|
||||||
echo "Linux Arch: 'sudo pacman -Sy && sudo pacman -S extra-testing/esptool'"
|
echo "Option Linux Arch: 'sudo pacman -Sy && sudo pacman -S extra-testing/esptool'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -92,7 +109,7 @@ jobs:
|
|||||||
|
|
||||||
|
|
||||||
# Firmware File
|
# Firmware File
|
||||||
if [ ! -f "firmware.bin" ]; then
|
if [ ! -f "$FIRMWARE" ]; then
|
||||||
echo -e "${RED}Error: No matching firmware binary found in this folder!${NC}"
|
echo -e "${RED}Error: No matching firmware binary found in this folder!${NC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -162,17 +179,12 @@ jobs:
|
|||||||
@echo off
|
@echo off
|
||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
echo ===================================================
|
echo ===================================================
|
||||||
echo === MeshCom Universal ESP32 Windows Flashing ======
|
echo === FoxMesh Universal ESP32 Windows Flashing ======
|
||||||
echo ===================================================
|
echo ===================================================
|
||||||
|
|
||||||
set "FIRMWARE=firmware.bin"
|
set "FIRMWARE=firmware.bin"
|
||||||
set "BOARD_NAME="
|
|
||||||
|
|
||||||
if exist "firmeware.bin" (
|
if not exist "!FIRMWARE!" (
|
||||||
set "BOARD_NAME=ESP32"
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%FIRMWARE%"="" (
|
|
||||||
echo [ERROR] No matching firmware binary found in this folder!
|
echo [ERROR] No matching firmware binary found in this folder!
|
||||||
pause
|
pause
|
||||||
exit /b 1
|
exit /b 1
|
||||||
@@ -211,9 +223,11 @@ jobs:
|
|||||||
esptool --chip esp32 --port %COMPORT% --baud 921600 write-flash -z !FLASH_ARGS!
|
esptool --chip esp32 --port %COMPORT% --baud 921600 write-flash -z !FLASH_ARGS!
|
||||||
|
|
||||||
if %ERRORLEVEL% EQU 0 (
|
if %ERRORLEVEL% EQU 0 (
|
||||||
echo === SUCCESS! %BOARD_NAME% successfully updated ===
|
echo === SUCCESS! Flash operation successfully completed ===
|
||||||
) else (
|
) else (
|
||||||
echo [ERROR] Flash failed!
|
echo [ERROR] Flash failed!
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
)
|
)
|
||||||
pause
|
pause
|
||||||
EOF
|
EOF
|
||||||
@@ -227,24 +241,27 @@ jobs:
|
|||||||
-e "s|__FIRMWARE_ADDR__|${FLASH_FIRMWARE_ADDR}|g" \
|
-e "s|__FIRMWARE_ADDR__|${FLASH_FIRMWARE_ADDR}|g" \
|
||||||
flash_esp32_board.bat
|
flash_esp32_board.bat
|
||||||
|
|
||||||
# ----------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# 3. Distribute Scripts into target build directories
|
# 3. Gather binaries and scripts into target directory for structural packaging
|
||||||
# ----------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# mkdir -p .pio/build/ttgo_tbeam
|
mkdir -p deploy_package
|
||||||
# mkdir -p .pio/build/ttgo-lora32-v21
|
BUILD_OUTPUT=".pio/build/ttgo-lora32-v21"
|
||||||
|
|
||||||
# cp flash_esp32_board.sh .pio/build/ttgo_tbeam/
|
# Copy binaries only if they exist
|
||||||
# cp flash_esp32_board.bat .pio/build/ttgo_tbeam/
|
[ -f "$BUILD_OUTPUT/firmware.bin" ] && cp "$BUILD_OUTPUT/firmware.bin" ./deploy_package/
|
||||||
|
[ -f "$BUILD_OUTPUT/bootloader.bin" ] && cp "$BUILD_OUTPUT/bootloader.bin" ./deploy_package/
|
||||||
|
[ -f "$BUILD_OUTPUT/partitions.bin" ] && cp "$BUILD_OUTPUT/partitions.bin" ./deploy_package/
|
||||||
|
[ -f "$BUILD_OUTPUT/otadata.bin" ] && cp "$BUILD_OUTPUT/otadata.bin" ./deploy_package/
|
||||||
|
[ -f "$BUILD_OUTPUT/safeboot.bin" ] && cp "$BUILD_OUTPUT/safeboot.bin" ./deploy_package/
|
||||||
|
|
||||||
# cp flash_esp32_board.sh .pio/build/ttgo-lora32-v21/
|
# Move flash scripts into the deployment directory
|
||||||
# cp flash_esp32_board.bat .pio/build/ttgo-lora32-v21/
|
mv flash_esp32_board.sh ./deploy_package/
|
||||||
|
mv flash_esp32_board.bat ./deploy_package/
|
||||||
|
|
||||||
# 12. Upload all compiled firmware artifacts with zip compression
|
# 9. Dynamic Artifact Upload: FoxMesh-branch-date-hash.zip
|
||||||
- name: Upload Compiled Firmware Artifacts
|
- name: Upload Compiled Firmware Package
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: firmware-build-${{ github.event.inputs.target_branch || github.ref_name }}
|
name: FoxMesh-${{ env.GIT_BRANCH }}-${{ env.CURRENT_DATE }}-${{ env.GIT_HASH }}
|
||||||
path: |
|
path: deploy_package/
|
||||||
.pio/build/**/*.bin
|
|
||||||
# flash_esp32_board.*
|
|
||||||
retention-days: 10 # Artifacts will be automatically deleted after 10 days
|
retention-days: 10 # Artifacts will be automatically deleted after 10 days
|
||||||
In neuem Issue referenzieren
Einen Benutzer sperren