Skip to content

Commit 4722879

Browse files
authored
[2.0.0] Update release builder and package json (#4826)
1 parent 33d8939 commit 4722879

File tree

3 files changed

+64
-23
lines changed

3 files changed

+64
-23
lines changed

Diff for: .github/scripts/on-release.sh

+46-22
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ cp -f "$GITHUB_WORKSPACE/tools/gen_esp32part.py" "$PKG_DIR/tools/"
183183
cp -f "$GITHUB_WORKSPACE/tools/gen_esp32part.exe" "$PKG_DIR/tools/"
184184
cp -Rf "$GITHUB_WORKSPACE/tools/partitions" "$PKG_DIR/tools/"
185185
cp -Rf "$GITHUB_WORKSPACE/tools/sdk" "$PKG_DIR/tools/"
186+
cp -f $GITHUB_WORKSPACE/tools/platformio-build*.py "$PKG_DIR/tools/"
186187

187188
# Remove unnecessary files in the package folder
188189
echo "Cleaning up folders ..."
@@ -194,6 +195,7 @@ echo "Generating platform.txt..."
194195
cat "$GITHUB_WORKSPACE/platform.txt" | \
195196
sed "s/version=.*/version=$ver$extent/g" | \
196197
sed 's/runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf//g' | \
198+
sed 's/runtime.tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf//g' | \
197199
sed 's/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' \
198200
> "$PKG_DIR/platform.txt"
199201

@@ -254,35 +256,43 @@ releasesJson=`curl -sH "Authorization: token $GITHUB_TOKEN" "https://api.github.
254256
if [ $? -ne 0 ]; then echo "ERROR: Get Releases Failed! ($?)"; exit 1; fi
255257

256258
set +e
257-
prev_release=$(echo "$releasesJson" | jq -e -r '. | map(select(.draft == false and .prerelease == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name')
258-
prev_any_release=$(echo "$releasesJson" | jq -e -r '. | map(select(.draft == false)) | sort_by(.created_at | - fromdateiso8601) | .[0].tag_name')
259+
prev_release=$(echo "$releasesJson" | jq -e -r ". | map(select(.draft == false and .prerelease == false)) | sort_by(.published_at | - fromdateiso8601) | .[0].tag_name")
260+
prev_any_release=$(echo "$releasesJson" | jq -e -r ". | map(select(.draft == false)) | sort_by(.published_at | - fromdateiso8601) | .[0].tag_name")
261+
prev_branch_release=$(echo "$releasesJson" | jq -e -r ". | map(select(.draft == false and .prerelease == false and .target_commitish == \"$RELEASE_BRANCH\")) | sort_by(.published_at | - fromdateiso8601) | .[0].tag_name")
262+
prev_branch_any_release=$(echo "$releasesJson" | jq -e -r ". | map(select(.draft == false and .target_commitish == \"$RELEASE_BRANCH\")) | sort_by(.published_at | - fromdateiso8601) | .[0].tag_name")
259263
shopt -s nocasematch
264+
if [ "$prev_release" == "$RELEASE_TAG" ]; then
265+
prev_release=$(echo "$releasesJson" | jq -e -r ". | map(select(.draft == false and .prerelease == false)) | sort_by(.published_at | - fromdateiso8601) | .[1].tag_name")
266+
fi
260267
if [ "$prev_any_release" == "$RELEASE_TAG" ]; then
261-
prev_release=$(echo "$releasesJson" | jq -e -r '. | map(select(.draft == false and .prerelease == false)) | sort_by(.created_at | - fromdateiso8601) | .[1].tag_name')
262-
prev_any_release=$(echo "$releasesJson" | jq -e -r '. | map(select(.draft == false)) | sort_by(.created_at | - fromdateiso8601) | .[1].tag_name')
268+
prev_any_release=$(echo "$releasesJson" | jq -e -r ". | map(select(.draft == false)) | sort_by(.published_at | - fromdateiso8601) | .[1].tag_name")
269+
fi
270+
if [ "$prev_branch_release" == "$RELEASE_TAG" ]; then
271+
prev_branch_release=$(echo "$releasesJson" | jq -e -r ". | map(select(.draft == false and .prerelease == false and .target_commitish == \"$RELEASE_BRANCH\")) | sort_by(.published_at | - fromdateiso8601) | .[1].tag_name")
272+
fi
273+
if [ "$prev_branch_any_release" == "$RELEASE_TAG" ]; then
274+
prev_branch_any_release=$(echo "$releasesJson" | jq -e -r ". | map(select(.draft == false and .target_commitish == \"$RELEASE_BRANCH\")) | sort_by(.published_at | - fromdateiso8601) | .[1].tag_name")
263275
fi
264-
COMMITS_SINCE_RELEASE="$prev_any_release"
265276
shopt -u nocasematch
266277
set -e
267278

279+
echo "Previous Release: $prev_release"
280+
echo "Previous (any)release: $prev_any_release"
281+
echo
282+
268283
# Merge package JSONs with previous releases
269284
if [ ! -z "$prev_any_release" ] && [ "$prev_any_release" != "null" ]; then
270285
echo "Merging with JSON from $prev_any_release ..."
271286
merge_package_json "$prev_any_release/$PACKAGE_JSON_DEV" "$OUTPUT_DIR/$PACKAGE_JSON_DEV"
272287
fi
273288

274289
if [ "$RELEASE_PRE" == "false" ]; then
275-
COMMITS_SINCE_RELEASE="$prev_release"
276290
if [ ! -z "$prev_release" ] && [ "$prev_release" != "null" ]; then
277291
echo "Merging with JSON from $prev_release ..."
278292
merge_package_json "$prev_release/$PACKAGE_JSON_REL" "$OUTPUT_DIR/$PACKAGE_JSON_REL"
279293
fi
280294
fi
281295

282-
echo "Previous Release: $prev_release"
283-
echo "Previous (any)release: $prev_any_release"
284-
echo
285-
286296
# Upload package JSONs
287297
echo "Uploading $PACKAGE_JSON_DEV ..."
288298
echo "Download URL: "`git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_DEV"`
@@ -327,21 +337,35 @@ if [ $arrLen > 3 ] && [ "${msgArray[0]:0:3}" == "tag" ]; then
327337
fi
328338

329339
# Append Commit Messages
340+
echo
341+
echo "Previous Branch Release: $prev_branch_release"
342+
echo "Previous Branch (any)release: $prev_branch_any_release"
343+
echo
344+
commitFile="$OUTPUT_DIR/commits.txt"
345+
COMMITS_SINCE_RELEASE="$prev_branch_any_release"
346+
if [ "$RELEASE_PRE" == "false" ]; then
347+
COMMITS_SINCE_RELEASE="$prev_branch_release"
348+
fi
330349
if [ ! -z "$COMMITS_SINCE_RELEASE" ] && [ "$COMMITS_SINCE_RELEASE" != "null" ]; then
331350
echo "Getting commits since $COMMITS_SINCE_RELEASE ..."
332-
commitFile=$OUTPUT_DIR/commits.txt
333-
git -C "$GITHUB_WORKSPACE" log --oneline "$COMMITS_SINCE_RELEASE..HEAD" > "$OUTPUT_DIR/commits.txt"
334-
releaseNotes+=$'\r\n##### Commits\r\n'
335-
IFS=$'\n'
336-
for next in `cat $commitFile`
337-
do
338-
IFS=' ' read -r commitId commitMsg <<< "$next"
339-
commitLine="- [$commitId](https://github.com/$GITHUB_REPOSITORY/commit/$commitId) $commitMsg"
340-
releaseNotes+="$commitLine"
341-
releaseNotes+=$'\r\n'
342-
done
343-
rm -f $commitFile
351+
git -C "$GITHUB_WORKSPACE" log --oneline -n 500 "$COMMITS_SINCE_RELEASE..HEAD" > "$commitFile"
352+
elif [ "$RELEASE_BRANCH" != "master" ]; then
353+
echo "Getting all commits on branch '$RELEASE_BRANCH' ..."
354+
git -C "$GITHUB_WORKSPACE" log --oneline -n 500 --cherry-pick --left-only --no-merges HEAD...origin/master > "$commitFile"
355+
else
356+
echo "Getting all commits on master ..."
357+
git -C "$GITHUB_WORKSPACE" log --oneline -n 500 --no-merges > "$commitFile"
344358
fi
359+
releaseNotes+=$'\r\n##### Commits\r\n'
360+
IFS=$'\n'
361+
for next in `cat $commitFile`
362+
do
363+
IFS=' ' read -r commitId commitMsg <<< "$next"
364+
commitLine="- [$commitId](https://github.com/$GITHUB_REPOSITORY/commit/$commitId) $commitMsg"
365+
releaseNotes+="$commitLine"
366+
releaseNotes+=$'\r\n'
367+
done
368+
rm -f $commitFile
345369

346370
# Prepend the original release body
347371
if [ "${RELEASE_BODY: -1}" == $'\r' ]; then

Diff for: .github/workflows/release.yml

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@master
14+
with:
15+
fetch-depth: 0
1416
- uses: actions/setup-python@v1
1517
with:
1618
python-version: '3.x'

Diff for: package/package_esp32_index.template.json

+16-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@
3636
{
3737
"packager": "esp32",
3838
"name": "xtensa-esp32-elf-gcc",
39-
"version": "1.22.0-96-g2852398-5.2.0"
39+
"version": "gcc8_4_0-esp-2020r3"
40+
},
41+
{
42+
"packager": "esp32",
43+
"name": "xtensa-esp32s2-elf-gcc",
44+
"version": "gcc8_4_0-esp-2020r3"
4045
},
4146
{
4247
"packager": "esp32",
@@ -47,6 +52,16 @@
4752
"packager": "esp32",
4853
"name": "mkspiffs",
4954
"version": "0.2.3"
55+
},
56+
{
57+
"packager": "esp32",
58+
"name": "mkfatfs",
59+
"version": "0.3.6"
60+
},
61+
{
62+
"packager": "esp32",
63+
"name": "mklittlefs",
64+
"version": "3.0.0-gnu12-dc7f933"
5065
}
5166
]
5267
}

0 commit comments

Comments
 (0)