Skip to content

Commit 076e1e7

Browse files
committed
Merge branch 'master' into release/v5.3
2 parents 70f28a9 + 7febf78 commit 076e1e7

File tree

3 files changed

+62
-8
lines changed

3 files changed

+62
-8
lines changed

.github/workflows/cron.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
# │ │ │ │ │
1313
# * * * * *
1414
- cron: '0 */6 * * *'
15-
workflow_dispatch: # For testing
15+
workflow_dispatch: # For manually rebuilding the libraries
1616

1717
defaults:
1818
run:

tools/check-deploy-needed.sh

+20-4
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,35 @@ AR_NEW_COMMIT_MESSAGE="IDF $IDF_BRANCH $IDF_COMMIT"
3737
AR_NEW_PR_TITLE="IDF $IDF_BRANCH"
3838

3939
LIBS_RELEASE_TAG="idf-"${IDF_BRANCH//\//_}""
40-
LIBS_VERSION="$LIBS_RELEASE_TAG-$IDF_COMMIT"
40+
LIBS_VERSION_PREFIX="$LIBS_RELEASE_TAG-$IDF_COMMIT-v"
41+
VERSION_COUNTER=1
4142

4243
AR_HAS_BRANCH=`github_branch_exists "$AR_REPO" "$AR_NEW_BRANCH_NAME"`
4344
if [ "$AR_HAS_BRANCH" == "1" ]; then
44-
AR_HAS_COMMIT=`github_commit_exists "$AR_REPO" "$AR_NEW_BRANCH_NAME" "$IDF_COMMIT"`
45+
LATEST_LIBS_IDF=`github_get_libs_idf "$AR_REPO" "$AR_NEW_BRANCH_NAME" "$AR_NEW_PR_TITLE"`
4546
else
46-
AR_HAS_COMMIT=`github_commit_exists "$AR_REPO" "$AR_BRANCH" "$IDF_COMMIT"`
47+
LATEST_LIBS_IDF=`github_get_libs_idf "$AR_REPO" "$AR_BRANCH" "$AR_NEW_PR_TITLE"`
4748
fi
49+
AR_HAS_COMMIT=`if [ "$LATEST_LIBS_IDF" == "$IDF_COMMIT" ]; then echo "1"; else echo "0"; fi`
4850
AR_HAS_PR=`github_pr_exists "$AR_REPO" "$AR_NEW_BRANCH_NAME"`
4951

5052
LIBS_RELEASE_ID=`github_release_id "$AR_LIBS_REPO" "$LIBS_RELEASE_TAG"`
5153
LIBS_HAS_RELEASE=`if [ -n "$LIBS_RELEASE_ID" ]; then echo "1"; else echo "0"; fi`
52-
LIBS_ASSET_ID=`github_release_asset_id "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "esp32-arduino-libs-$LIBS_VERSION.zip"`
54+
55+
if [ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]; then
56+
while true; do
57+
LIBS_ASSET_ID=`github_release_asset_id "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "esp32-arduino-libs-$LIBS_VERSION_PREFIX$VERSION_COUNTER.zip"`
58+
if [ -n "$LIBS_ASSET_ID" ]; then
59+
VERSION_COUNTER=$((VERSION_COUNTER+1))
60+
else
61+
break
62+
fi
63+
done
64+
else
65+
LIBS_ASSET_ID=`github_release_asset_id "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "esp32-arduino-libs-$LIBS_VERSION_PREFIX$VERSION_COUNTER.zip"`
66+
fi
67+
68+
LIBS_VERSION="$LIBS_VERSION_PREFIX$VERSION_COUNTER"
5369
LIBS_HAS_ASSET=`if [ -n "$LIBS_ASSET_ID" ]; then echo "1"; else echo "0"; fi`
5470

5571
export IDF_COMMIT

tools/config.sh

+41-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if [ -z $IDF_TARGET ]; then
2525
fi
2626

2727
# Owner of the target ESP32 Arduino repository
28-
AR_USER="espressif"
28+
AR_USER="lucasssvaz"
2929

3030
# The full name of the repository
3131
AR_REPO="$AR_USER/arduino-esp32"
@@ -99,12 +99,50 @@ if [[ "$AR_OS" == "macos" ]]; then
9999
export SSTAT="stat -f %z"
100100
fi
101101

102+
function github_get_libs_idf(){ # github_get_libs_idf <repo-path> <branch-name> <message-prefix>
103+
local repo_path="$1"
104+
local branch_name="$2"
105+
local message_prefix="$3"
106+
local page=1
107+
local version_found=""
108+
local libs_version=""
109+
110+
while [ "$libs_version" == "" ]; do
111+
version_found=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/commits?sha=$branch_name&per_page=100&page=$page" | jq -r '.[].commit.message' | grep -m 1 "$message_prefix" | cut -d' ' -f3`
112+
if [ ! "$version_found" == "" ] && [ ! "$version_found" == "null" ]; then
113+
libs_version=$version_found
114+
else
115+
page=$((page+1))
116+
fi
117+
done
118+
119+
if [ ! "$libs_version" == "" ] && [ ! "$libs_version" == "null" ]; then echo $libs_version; else echo ""; fi
120+
}
121+
102122
function github_commit_exists(){ #github_commit_exists <repo-path> <branch-name> <commit-message>
103123
local repo_path="$1"
104124
local branch_name="$2"
105125
local commit_message="$3"
106-
local commits_found=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/commits?sha=$branch_name" | jq -r '.[].commit.message' | grep "$commit_message" | wc -l`
107-
if [ ! "$commits_found" == "" ] && [ ! "$commits_found" == "null" ] && [ ! "$commits_found" == "0" ]; then echo $commits_found; else echo 0; fi
126+
local page=1
127+
local commits_found=0
128+
129+
while true; do
130+
local response=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/commits?sha=$branch_name&per_page=100&page=$page"`
131+
132+
if [[ -z "$response" || "$response" == "[]" ]]; then
133+
break
134+
fi
135+
136+
local commits=`echo "$response" | jq -r '.[].commit.message' | grep "$commit_message" | wc -l`
137+
if [ "$commits" -gt 0 ]; then
138+
commits_found=1
139+
break
140+
fi
141+
142+
page=$((page+1))
143+
done
144+
145+
echo $commits_found
108146
}
109147

110148
function github_last_commit(){ # github_last_commit <repo-path> <branch-name>

0 commit comments

Comments
 (0)