Skip to content

Commit 6297921

Browse files
authored
Improve tag name generation in workflow
1 parent c0e68cd commit 6297921

File tree

1 file changed

+49
-3
lines changed

1 file changed

+49
-3
lines changed

.github/workflows/parallel_build.yaml

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,55 @@ jobs:
110110
- name: Set tag name
111111
id: set_tag_name
112112
run: |
113-
IDF_VERSION=$(grep 'esp-idf branch' release-info.txt | sed -E 's/.*branch \[release\/v([0-9]+\.[0-9]+)\].*/\1/')
114-
DATE=$(date +"%d%m-%H%M")
115-
echo "tag_name=${DATE}-${IDF_VERSION}" >> $GITHUB_OUTPUT
113+
# Debug: Zeige den Inhalt von release-info.txt
114+
echo "=== Content of release-info.txt ==="
115+
cat release-info.txt
116+
echo "================================="
117+
118+
# Extrahiere IDF Version mit vollständigem Muster
119+
# Erfasst: x.y, x.y.z, x.y_suffix, x.y.z_suffix, etc.
120+
IDF_VERSION=$(grep 'esp-idf branch' release-info.txt | sed -E 's/.*branch \[release\/v([0-9]+\.[0-9]+(\.[0-9]+)?([_.-]?[a-zA-Z0-9]+)*)\].*/\1/' | head -1)
121+
122+
# Fallback: Versuche ohne "release/" Präfix
123+
if [ -z "$IDF_VERSION" ]; then
124+
IDF_VERSION=$(grep 'esp-idf branch' release-info.txt | sed -E 's/.*branch \[v([0-9]+\.[0-9]+(\.[0-9]+)?([_.-]?[a-zA-Z0-9]+)*)\].*/\1/' | head -1)
125+
fi
126+
127+
# Fallback: Extrahiere beliebige Versionsnummer nach "v"
128+
if [ -z "$IDF_VERSION" ]; then
129+
IDF_VERSION=$(grep 'esp-idf branch' release-info.txt | sed -E 's/.*v([0-9]+\.[0-9]+[._-]?[a-zA-Z0-9]*).*/\1/' | head -1)
130+
fi
131+
132+
# Default falls nichts gefunden wird
133+
if [ -z "$IDF_VERSION" ]; then
134+
IDF_VERSION="unknown"
135+
fi
136+
137+
# Datum im ISO Format (git-freundlich)
138+
DATE=$(date +"%Y%m%d-%H%M")
139+
140+
# Tag name erstellen - alle Zeichen sind Git-kompatibel
141+
TAG_NAME="v${DATE}-idf${IDF_VERSION}"
142+
143+
echo "IDF_VERSION: $IDF_VERSION"
144+
echo "DATE: $DATE"
145+
echo "TAG_NAME: $TAG_NAME"
146+
147+
# Validiere Tag-Name Format (erlaubt Punkte, Unterstriche, Bindestriche)
148+
if [[ "$TAG_NAME" =~ ^[a-zA-Z0-9._-]+$ ]]; then
149+
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
150+
else
151+
echo "ERROR: Invalid tag name format: $TAG_NAME"
152+
exit 1
153+
fi
154+
155+
- name: Debug tag name
156+
run: |
157+
echo "Generated tag name: ${{ steps.set_tag_name.outputs.tag_name }}"
158+
if [ -z "${{ steps.set_tag_name.outputs.tag_name }}" ]; then
159+
echo "ERROR: tag_name is empty!"
160+
exit 1
161+
fi
116162
117163
- name: Release framework-arduinoespressif32
118164
uses: jason2866/[email protected]

0 commit comments

Comments
 (0)