Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 65e6fb1

Browse files
lucasssvazme-no-dev
andauthoredAug 19, 2024
Split cron jobs and move libs to releases (espressif#187)
* Split cron jobs using matrix * Move to workflow call * Use github releases for libs * Enable ccache by default * Fix push --------- Co-authored-by: Me No Dev <[email protected]>
1 parent 2a45ca0 commit 65e6fb1

File tree

10 files changed

+379
-281
lines changed

10 files changed

+379
-281
lines changed
 

‎.github/workflows/cron.yml

Lines changed: 15 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -1,144 +1,36 @@
1-
name: Cron Build
1+
name: Cron Deploy
22

3-
on:
3+
on:
44
schedule:
55
# ┌───────────── minute (0 - 59)
66
# │ ┌───────────── hour (0 - 23)
77
# │ │ ┌───────────── day of the month (1 - 31)
88
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
99
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
10-
# │ │ │ │ │
10+
# │ │ │ │ │
1111
# │ │ │ │ │
1212
# │ │ │ │ │
1313
# * * * * *
1414
- cron: '0 */6 * * *'
15+
workflow_dispatch: # For testing
1516

1617
defaults:
1718
run:
1819
shell: bash
1920

2021
jobs:
21-
run:
22+
build-libs:
2223
name: Build with IDF ${{ matrix.idf_branch }}
23-
runs-on: ubuntu-latest
24-
24+
uses: ./.github/workflows/cron_build.yml
25+
with:
26+
idf_branch: ${{ matrix.idf_branch }}
27+
lib_builder_branch: ${{ matrix.lib_builder_branch }}
28+
targets: ${{ matrix.targets }}
29+
secrets: inherit
2530
strategy:
2631
fail-fast: false
2732
matrix:
28-
idf_branch: [release/v5.1, release/v4.4] #, release/v3.3]
29-
steps:
30-
- uses: actions/checkout@v4
31-
with:
32-
fetch-depth: 0
33-
- name: Install dependencies
34-
run: bash ./tools/prepare-ci.sh
35-
- name: Build
36-
env:
37-
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
38-
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }}
39-
GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }}
40-
IDF_BRANCH: ${{ matrix.idf_branch }}
41-
run: |
42-
git checkout ${{ matrix.idf_branch }} || echo "Using master branch"
43-
bash ./tools/cron.sh
44-
- name: Upload build
45-
if: failure()
46-
uses: actions/upload-artifact@v4
47-
with:
48-
name: build
49-
path: build
50-
- name: Upload archive
51-
uses: actions/upload-artifact@v4
52-
with:
53-
name: artifacts
54-
path: dist
55-
56-
57-
# check:
58-
# name: Check if result should be deployed
59-
# runs-on: ubuntu-latest
60-
# strategy:
61-
# matrix:
62-
# branch: [release/v5.1, release/v4.4] #, release/v3.3]
63-
# outputs:
64-
# idf_branch: ${{ steps.check.outputs.idf_branch }}
65-
# idf_commit: ${{ steps.check.outputs.idf_commit }}
66-
# ar_branch: ${{ steps.check.outputs.ar_branch }}
67-
# ar_new_commit_message: ${{ steps.check.outputs.ar_new_commit_message }}
68-
# ar_new_branch_name: ${{ steps.check.outputs.ar_new_branch_name }}
69-
# ar_new_pr_title: ${{ steps.check.outputs.ar_new_pr_title }}
70-
# ar_has_commit: ${{ steps.check.outputs.ar_has_commit }}
71-
# ar_has_branch: ${{ steps.check.outputs.ar_has_branch }}
72-
# ar_has_pr: ${{ steps.check.outputs.ar_has_pr }}
73-
# libs_version: ${{ steps.check.outputs.libs_version }}
74-
# libs_has_commit: ${{ steps.check.outputs.libs_has_commit }}
75-
# libs_has_branch: ${{ steps.check.outputs.libs_has_branch }}
76-
# steps:
77-
# - uses: actions/checkout@v3
78-
# - id: check
79-
# env:
80-
# GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
81-
# GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }}
82-
# GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }}
83-
# IDF_BRANCH: ${{ matrix.idf_branch }}
84-
# run: bash ./tools/check-deploy-needed.sh
85-
86-
# build:
87-
# name: Build Libs for ${{ matrix.target }}
88-
# runs-on: ubuntu-latest
89-
# needs: check
90-
# if: needs.check.outputs.libs_has_commit == '0' || needs.check.outputs.ar_has_commit == '0'
91-
# strategy:
92-
# matrix:
93-
# target: [esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32h2]
94-
# fail-fast: false
95-
# steps:
96-
# - uses: actions/checkout@v3
97-
# # - name: Install dependencies
98-
# # run: bash ./tools/prepare-ci.sh
99-
# - shell: bash
100-
# name: Build Libs for ${{ matrix.target }}
101-
# run: echo ${{ matrix.target }}
102-
# # run: bash ./build.sh -t ${{ matrix.target }}
103-
# # - name: Upload archive
104-
# # uses: actions/upload-artifact@v3
105-
# # with:
106-
# # name: artifacts
107-
# # path: dist
108-
109-
# deploy:
110-
# name: Deploy build
111-
# runs-on: ubuntu-latest
112-
# needs: [check, build]
113-
# steps:
114-
# - uses: actions/checkout@v3
115-
# - shell: bash
116-
# env:
117-
# GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
118-
# GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }}
119-
# GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }}
120-
# IDF_BRANCH: ${{ needs.check.outputs.idf_branch }}
121-
# IDF_COMMIT: ${{ needs.check.outputs.idf_commit }}
122-
# AR_BRANCH: ${{ needs.check.outputs.ar_branch }}
123-
# AR_NEW_COMMIT_MESSAGE: ${{ needs.check.outputs.ar_new_commit_message }}
124-
# AR_NEW_BRANCH_NAME: ${{ needs.check.outputs.ar_new_branch_name }}
125-
# AR_NEW_PR_TITLE: ${{ needs.check.outputs.ar_new_pr_title }}
126-
# AR_HAS_COMMIT: ${{ needs.check.outputs.ar_has_commit }}
127-
# AR_HAS_BRANCH: ${{ needs.check.outputs.ar_has_branch }}
128-
# AR_HAS_PR: ${{ needs.check.outputs.ar_has_pr }}
129-
# LIBS_VERSION: ${{ needs.check.outputs.libs_version }}
130-
# LIBS_HAS_COMMIT: ${{ needs.check.outputs.libs_has_commit }}
131-
# LIBS_HAS_BRANCH: ${{ needs.check.outputs.libs_has_branch }}
132-
# run: |
133-
# echo "IDF_COMMIT: $IDF_COMMIT"
134-
# echo "AR_BRANCH: $AR_BRANCH"
135-
# echo "AR_NEW_COMMIT_MESSAGE: $AR_NEW_COMMIT_MESSAGE"
136-
# echo "AR_NEW_BRANCH_NAME: $AR_NEW_BRANCH_NAME"
137-
# echo "AR_NEW_PR_TITLE: $AR_NEW_PR_TITLE"
138-
# echo "AR_HAS_COMMIT: $AR_HAS_COMMIT"
139-
# echo "AR_HAS_BRANCH: $AR_HAS_BRANCH"
140-
# echo "AR_HAS_PR: $AR_HAS_PR"
141-
# echo "LIBS_VERSION: $LIBS_VERSION"
142-
# echo "LIBS_HAS_COMMIT: $LIBS_HAS_COMMIT"
143-
# echo "LIBS_HAS_BRANCH: $LIBS_HAS_BRANCH"
144-
33+
include:
34+
- idf_branch: "release/v5.1"
35+
lib_builder_branch: "master"
36+
targets: "esp32,esp32s2,esp32s3,esp32c3,esp32c6,esp32h2"

‎.github/workflows/cron_build.yml

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Cron Build Matrix
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
idf_branch:
7+
type: string
8+
required: true
9+
description: 'IDF branch to build'
10+
lib_builder_branch:
11+
type: string
12+
required: true
13+
description: 'Branch of the lib-builder to use'
14+
targets:
15+
type: string
16+
required: true
17+
description: 'Targets to build'
18+
19+
env:
20+
IDF_BRANCH: ${{ inputs.idf_branch }}
21+
22+
jobs:
23+
check-if-needed:
24+
name: Check if deploy is needed for ${{ inputs.idf_branch }}
25+
runs-on: ubuntu-latest
26+
outputs:
27+
idf_commit: ${{ steps.check.outputs.idf_commit }}
28+
ar_branch: ${{ steps.check.outputs.ar_branch }}
29+
ar_new_commit_message: ${{ steps.check.outputs.ar_new_commit_message }}
30+
ar_new_branch_name: ${{ steps.check.outputs.ar_new_branch_name }}
31+
ar_new_pr_title: ${{ steps.check.outputs.ar_new_pr_title }}
32+
ar_has_commit: ${{ steps.check.outputs.ar_has_commit }}
33+
ar_has_branch: ${{ steps.check.outputs.ar_has_branch }}
34+
ar_has_pr: ${{ steps.check.outputs.ar_has_pr }}
35+
libs_release_tag: ${{ steps.check.outputs.libs_release_tag }}
36+
libs_version: ${{ steps.check.outputs.libs_version }}
37+
libs_release_id: ${{ steps.check.outputs.libs_release_id }}
38+
libs_has_release: ${{ steps.check.outputs.libs_has_release }}
39+
libs_asset_id: ${{ steps.check.outputs.libs_asset_id }}
40+
libs_has_asset: ${{ steps.check.outputs.libs_has_asset }}
41+
deploy_needed: ${{ steps.check.outputs.deploy_needed }}
42+
targets_list: ${{ steps.check.outputs.targets_list }}
43+
steps:
44+
- uses: actions/checkout@v4
45+
with:
46+
ref: ${{ inputs.lib_builder_branch }}
47+
48+
- name: Check deploy and generate variables
49+
id: check
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
run: |
53+
source ./tools/check-deploy-needed.sh
54+
targets_list=$(echo "${{ inputs.targets }}" | sed 's/ *, */,/g' | sed 's/^/["/' | sed 's/$/"]/' | sed 's/,/","/g')
55+
echo "Targets list: $targets_list"
56+
echo "targets_list=$targets_list" >> $GITHUB_OUTPUT
57+
58+
build-libs:
59+
name: Build for ${{ matrix.target }} (${{ inputs.idf_branch }})
60+
runs-on: ubuntu-latest
61+
if: needs.check-if-needed.outputs.deploy_needed == '1'
62+
needs: check-if-needed
63+
strategy:
64+
fail-fast: false
65+
matrix:
66+
target: ${{ fromJson(needs.check-if-needed.outputs.targets_list) }}
67+
steps:
68+
- uses: actions/checkout@v4
69+
with:
70+
ref: ${{ inputs.lib_builder_branch }}
71+
72+
- name: Install dependencies
73+
run: bash ./tools/prepare-ci.sh
74+
75+
- name: Build
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN || secrets.GITHUB_TOKEN }}
78+
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }}
79+
GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }}
80+
TARGET: ${{ matrix.target }}
81+
run: |
82+
bash ./tools/cron.sh
83+
84+
- name: Replace invalid characters in the artifact name
85+
run: |
86+
branch=${{ inputs.idf_branch }}
87+
echo "libs_branch=${branch//\//_}" >> $GITHUB_ENV
88+
89+
- name: Upload build
90+
if: failure()
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: build-${{ env.libs_branch }}-${{ matrix.target }}
94+
path: build
95+
96+
- name: Upload library files
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: libs-${{ env.libs_branch }}-${{ matrix.target }}
100+
path: dist
101+
102+
combine-artifacts:
103+
name: Combine artifacts and push changes for IDF ${{ inputs.idf_branch }}
104+
runs-on: ubuntu-latest
105+
needs: [check-if-needed, build-libs]
106+
if: needs.check-if-needed.outputs.deploy_needed == '1'
107+
steps:
108+
- uses: actions/checkout@v4
109+
with:
110+
ref: ${{ inputs.lib_builder_branch }}
111+
112+
- name: Replace invalid characters in the artifact name
113+
run: |
114+
branch=${{ inputs.idf_branch }}
115+
echo "libs_branch=${branch//\//_}" >> $GITHUB_ENV
116+
117+
- name: Download artifacts
118+
uses: actions/download-artifact@v4
119+
with:
120+
path: dist
121+
pattern: libs-${{ env.libs_branch }}-*
122+
merge-multiple: true
123+
124+
- name: Combine artifacts
125+
run: bash ./tools/combine-artifacts.sh
126+
127+
- name: Upload full esp32-arduino-libs archive
128+
uses: actions/upload-artifact@v4
129+
with:
130+
name: esp32-arduino-libs-${{ env.libs_branch }}
131+
path: dist/esp32-arduino-libs.zip
132+
compression-level: 0
133+
134+
- name: Push changes
135+
if: github.repository == 'espressif/esp32-arduino-lib-builder'
136+
env:
137+
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
138+
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }}
139+
GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }}
140+
IDF_COMMIT: ${{ needs.check-if-needed.outputs.idf_commit }}
141+
AR_BRANCH: ${{ needs.check-if-needed.outputs.ar_branch }}
142+
AR_NEW_COMMIT_MESSAGE: ${{ needs.check-if-needed.outputs.ar_new_commit_message }}
143+
AR_NEW_BRANCH_NAME: ${{ needs.check-if-needed.outputs.ar_new_branch_name }}
144+
AR_NEW_PR_TITLE: ${{ needs.check-if-needed.outputs.ar_new_pr_title }}
145+
AR_HAS_COMMIT: ${{ needs.check-if-needed.outputs.ar_has_commit }}
146+
AR_HAS_BRANCH: ${{ needs.check-if-needed.outputs.ar_has_branch }}
147+
AR_HAS_PR: ${{ needs.check-if-needed.outputs.ar_has_pr }}
148+
LIBS_RELEASE_TAG: ${{ needs.check-if-needed.outputs.libs_release_tag }}
149+
LIBS_VERSION: ${{ needs.check-if-needed.outputs.libs_version }}
150+
LIBS_RELEASE_ID: ${{ needs.check-if-needed.outputs.libs_release_id }}
151+
LIBS_HAS_RELEASE: ${{ needs.check-if-needed.outputs.libs_has_release }}
152+
LIBS_ASSET_ID: ${{ needs.check-if-needed.outputs.libs_asset_id }}
153+
LIBS_HAS_ASSET: ${{ needs.check-if-needed.outputs.libs_has_asset }}
154+
run: |
155+
bash ./tools/push-to-arduino.sh
156+
157+
- name: Upload package_esp32_index.template.json
158+
uses: actions/upload-artifact@v4
159+
with:
160+
name: package-esp32-index-json-${{ env.libs_branch }}
161+
path: out/package_esp32_index.template.json

‎build.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ fi
1818
# Fixes building some components. See https://github.com/espressif/arduino-esp32/issues/10167
1919
export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1
2020

21+
CCACHE_ENABLE=1
22+
2123
TARGET="all"
2224
BUILD_TYPE="all"
2325
BUILD_DEBUG="default"
@@ -29,8 +31,9 @@ if [ -z $DEPLOY_OUT ]; then
2931
fi
3032

3133
function print_help() {
32-
echo "Usage: build.sh [-s] [-A <arduino_branch>] [-I <idf_branch>] [-D <debug_level>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]"
34+
echo "Usage: build.sh [-s] [-n] [-A <arduino_branch>] [-I <idf_branch>] [-D <debug_level>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]"
3335
echo " -s Skip installing/updating of ESP-IDF and all components"
36+
echo " -n Disable ccache"
3437
echo " -A Set which branch of arduino-esp32 to be used for compilation"
3538
echo " -I Set which branch of ESP-IDF to be used for compilation"
3639
echo " -i Set which commit of ESP-IDF to be used for compilation"
@@ -49,6 +52,9 @@ while getopts ":A:I:i:c:t:b:D:sde" opt; do
4952
s )
5053
SKIP_ENV=1
5154
;;
55+
n )
56+
CCACHE_ENABLE=0
57+
;;
5258
d )
5359
DEPLOY_OUT=1
5460
;;
@@ -99,6 +105,8 @@ done
99105
shift $((OPTIND -1))
100106
CONFIGS=$@
101107

108+
export IDF_CCACHE_ENABLE=$CCACHE_ENABLE
109+
102110
# Output the TARGET array
103111
echo "TARGET(s): ${TARGET[@]}"
104112

@@ -146,7 +154,7 @@ if [ "$BUILD_TYPE" != "all" ]; then
146154
# Skip building for targets that are not in the $TARGET array
147155
continue
148156
fi
149-
157+
150158
configs="configs/defconfig.common;configs/defconfig.$target;configs/defconfig.debug_$BUILD_DEBUG"
151159
for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do
152160
configs="$configs;configs/defconfig.$defconf"
@@ -191,7 +199,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
191199
continue
192200
fi
193201
fi
194-
202+
195203
# Skip chips that should not be a part of the final libs
196204
# WARNING!!! this logic needs to be updated when cron builds are split into jobs
197205
if [ "$TARGET" = "all" ] && [ $target_skip -eq 1 ]; then
@@ -291,13 +299,15 @@ done
291299

292300
# update package_esp32_index.template.json
293301
if [ "$BUILD_TYPE" = "all" ]; then
302+
echo "* Generating package_esp32_index.template.json..."
294303
python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/"
295304
python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -o "$TOOLS_JSON_OUT/"
296305
if [ $? -ne 0 ]; then exit 1; fi
297306
fi
298307

299308
# Generate PlatformIO manifest file
300309
if [ "$BUILD_TYPE" = "all" ]; then
310+
echo "* Generating PlatformIO manifest file..."
301311
pushd $IDF_PATH
302312
ibr=$(git describe --all 2>/dev/null)
303313
ic=$(git -C "$IDF_PATH" rev-parse --short HEAD)
@@ -308,18 +318,21 @@ fi
308318

309319
# copy everything to arduino-esp32 installation
310320
if [ $COPY_OUT -eq 1 ] && [ -d "$ESP32_ARDUINO" ]; then
321+
echo "* Copying to Arduino..."
311322
./tools/copy-to-arduino.sh
312323
if [ $? -ne 0 ]; then exit 1; fi
313324
fi
314325

315326
# push changes to esp32-arduino-libs and create pull request into arduino-esp32
316327
if [ $DEPLOY_OUT -eq 1 ]; then
328+
echo "* Pushing to Arduino..."
317329
./tools/push-to-arduino.sh
318330
if [ $? -ne 0 ]; then exit 1; fi
319331
fi
320332

321333
# archive the build
322334
if [ $ARCHIVE_OUT -eq 1 ]; then
335+
echo "* Archiving build..."
323336
./tools/archive-build.sh "$TARGET"
324337
if [ $? -ne 0 ]; then exit 1; fi
325338
fi

‎tools/check-deploy-needed.sh

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ source ./tools/config.sh
44

55
IDF_COMMIT=`github_last_commit "$IDF_REPO" "$IDF_BRANCH"`
66

7+
if [ -z $IDF_COMMIT ]; then
8+
echo "Failed to get IDF commit for branch $IDF_BRANCH"
9+
exit 1
10+
fi
11+
712
if [ -z $GITHUB_HEAD_REF ]; then
813
current_branch=`git branch --show-current`
914
else
@@ -31,7 +36,8 @@ AR_NEW_BRANCH_NAME="idf-$IDF_BRANCH"
3136
AR_NEW_COMMIT_MESSAGE="IDF $IDF_BRANCH $IDF_COMMIT"
3237
AR_NEW_PR_TITLE="IDF $IDF_BRANCH"
3338

34-
LIBS_VERSION="idf-"${IDF_BRANCH//\//_}"-$IDF_COMMIT"
39+
LIBS_RELEASE_TAG="idf-"${IDF_BRANCH//\//_}""
40+
LIBS_VERSION="$LIBS_RELEASE_TAG-$IDF_COMMIT"
3541

3642
AR_HAS_BRANCH=`github_branch_exists "$AR_REPO" "$AR_NEW_BRANCH_NAME"`
3743
if [ "$AR_HAS_BRANCH" == "1" ]; then
@@ -41,8 +47,10 @@ else
4147
fi
4248
AR_HAS_PR=`github_pr_exists "$AR_REPO" "$AR_NEW_BRANCH_NAME"`
4349

44-
LIBS_HAS_BRANCH=`github_branch_exists "$AR_LIBS_REPO" "$AR_NEW_BRANCH_NAME"`
45-
LIBS_HAS_COMMIT=`github_commit_exists "$AR_LIBS_REPO" "$AR_NEW_BRANCH_NAME" "$IDF_COMMIT"`
50+
LIBS_RELEASE_ID=`github_release_id "$AR_LIBS_REPO" "$LIBS_RELEASE_TAG"`
51+
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"`
53+
LIBS_HAS_ASSET=`if [ -n "$LIBS_ASSET_ID" ]; then echo "1"; else echo "0"; fi`
4654

4755
export IDF_COMMIT
4856

@@ -54,9 +62,25 @@ export AR_HAS_COMMIT
5462
export AR_HAS_BRANCH
5563
export AR_HAS_PR
5664

65+
export LIBS_RELEASE_TAG
5766
export LIBS_VERSION
58-
export LIBS_HAS_COMMIT
59-
export LIBS_HAS_BRANCH
67+
export LIBS_RELEASE_ID
68+
export LIBS_HAS_RELEASE
69+
export LIBS_ASSET_ID
70+
export LIBS_HAS_ASSET
71+
72+
if [ "$LIBS_HAS_RELEASE" == "1" ]; then
73+
if [ "$LIBS_HAS_ASSET" == "0" ] || [ "$AR_HAS_COMMIT" == "0" ]; then
74+
echo "Deploy needed"
75+
export DEPLOY_NEEDED="1"
76+
else
77+
echo "Deploy not needed. Skipping..."
78+
export DEPLOY_NEEDED="0"
79+
fi
80+
else
81+
echo "Release for tag \"$LIBS_RELEASE_TAG\" not found. Please create the release first."
82+
exit 1
83+
fi
6084

6185
echo "IDF_COMMIT: $IDF_COMMIT"
6286
echo "AR_BRANCH: $AR_BRANCH"
@@ -66,9 +90,13 @@ echo "AR_NEW_PR_TITLE: $AR_NEW_PR_TITLE"
6690
echo "AR_HAS_COMMIT: $AR_HAS_COMMIT"
6791
echo "AR_HAS_BRANCH: $AR_HAS_BRANCH"
6892
echo "AR_HAS_PR: $AR_HAS_PR"
93+
echo "LIBS_RELEASE_TAG: $LIBS_RELEASE_TAG"
6994
echo "LIBS_VERSION: $LIBS_VERSION"
70-
echo "LIBS_HAS_COMMIT: $LIBS_HAS_COMMIT"
71-
echo "LIBS_HAS_BRANCH: $LIBS_HAS_BRANCH"
95+
echo "LIBS_RELEASE_ID: $LIBS_RELEASE_ID"
96+
echo "LIBS_HAS_RELEASE: $LIBS_HAS_RELEASE"
97+
echo "LIBS_ASSET_ID: $LIBS_ASSET_ID"
98+
echo "LIBS_HAS_ASSET: $LIBS_HAS_ASSET"
99+
echo "DEPLOY_NEEDED: $DEPLOY_NEEDED"
72100

73101
if [ ! -x $GITHUB_OUTPUT ]; then
74102
echo "idf_commit=$IDF_COMMIT" >> "$GITHUB_OUTPUT"
@@ -79,7 +107,12 @@ if [ ! -x $GITHUB_OUTPUT ]; then
79107
echo "ar_has_commit=$AR_HAS_COMMIT" >> "$GITHUB_OUTPUT"
80108
echo "ar_has_branch=$AR_HAS_BRANCH" >> "$GITHUB_OUTPUT"
81109
echo "ar_has_pr=$AR_HAS_PR" >> "$GITHUB_OUTPUT"
110+
echo "libs_release_tag=$LIBS_RELEASE_TAG" >> "$GITHUB_OUTPUT"
82111
echo "libs_version=$LIBS_VERSION" >> "$GITHUB_OUTPUT"
83-
echo "libs_has_commit=$LIBS_HAS_COMMIT" >> "$GITHUB_OUTPUT"
84-
echo "libs_has_branch=$LIBS_HAS_BRANCH" >> "$GITHUB_OUTPUT"
112+
echo "libs_release_id=$LIBS_RELEASE_ID" >> "$GITHUB_OUTPUT"
113+
echo "libs_has_release=$LIBS_HAS_RELEASE" >> "$GITHUB_OUTPUT"
114+
echo "libs_asset_id=$LIBS_ASSET_ID" >> "$GITHUB_OUTPUT"
115+
echo "libs_has_asset=$LIBS_HAS_ASSET" >> "$GITHUB_OUTPUT"
116+
echo "deploy_needed=$DEPLOY_NEEDED" >> "$GITHUB_OUTPUT"
85117
fi
118+

‎tools/combine-artifacts.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -e
4+
mkdir -p out
5+
6+
libs_folder="out/tools/esp32-arduino-libs"
7+
8+
files=$(find dist -name 'arduino-esp32-libs-esp*.tar.gz')
9+
for file in $files; do
10+
echo "Extracting $file"
11+
tar zxf $file -C out
12+
cat $libs_folder/versions.txt >> $libs_folder/versions_full.txt
13+
done
14+
15+
# Merge versions.txt files
16+
awk -i inplace '!seen[$0]++' $libs_folder/versions_full.txt
17+
mv -f $libs_folder/versions_full.txt $libs_folder/versions.txt
18+
19+
echo "Creating zip file"
20+
cd out/tools && zip -q -r ../../dist/esp32-arduino-libs.zip * && cd ../..

‎tools/config.sh

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ AR_GEN_PART_PY="$AR_TOOLS/gen_esp32part.py"
5151
AR_SDK="$AR_TOOLS/esp32-arduino-libs/$IDF_TARGET"
5252
PIO_SDK="FRAMEWORK_SDK_DIR, \"$IDF_TARGET\""
5353
TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs"
54-
IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs"
5554

5655
if [ -d "$IDF_PATH" ]; then
5756
export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD)
@@ -133,6 +132,37 @@ function github_pr_exists(){ # github_pr_exists <repo-path> <branch-name>
133132
if [ ! "$pr_num" == "" ] && [ ! "$pr_num" == "null" ]; then echo 1; else echo 0; fi
134133
}
135134

135+
function github_release_id(){ # github_release_id <repo-path> <release-tag>
136+
local repo_path="$1"
137+
local release_tag="$2"
138+
local release=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/releases" | jq --arg release_tag "$release_tag" -r '.[] | select(.tag_name == $release_tag) | .id'`
139+
if [ ! "$release" == "" ] && [ ! "$release" == "null" ]; then echo "$release"; else echo ""; fi
140+
}
141+
142+
function github_release_asset_id(){ # github_release_asset_id <repo-path> <release-id> <release-file>
143+
local repo_path="$1"
144+
local release_id="$2"
145+
local release_file="$3"
146+
local release_asset=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/releases/$release_id/assets" | jq --arg release_file "$release_file" -r '.[] | select(.name == $release_file) | .id'`
147+
if [ ! "$release_asset" == "" ] && [ ! "$release_asset" == "null" ]; then echo "$release_asset"; else echo ""; fi
148+
}
149+
150+
function github_release_asset_upload(){ # github_release_asset_upload <repo-path> <release-id> <release-file-name> <release-file-path>
151+
local repo_path="$1"
152+
local release_id="$2"
153+
local release_file_name="$3"
154+
local release_file_path="$4"
155+
local file_extension="${release_file_name##*.}"
156+
local release_asset=`curl -s -k -X POST -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" -H "Content-Type: application/$file_extension" --data-binary "@$release_file_path" "https://uploads.github.com/repos/$repo_path/releases/$release_id/assets?name=$release_file_name" | jq -r '.id'`
157+
if [ ! "$release_asset" == "" ] && [ ! "$release_asset" == "null" ]; then echo "$release_asset"; else echo ""; fi
158+
}
159+
160+
function github_release_asset_delete(){ # github_release_asset_delete <repo-path> <release-asset-id>
161+
local repo_path="$1"
162+
local release_asset_id="$2"
163+
local res=$(curl -s -k -o /dev/null -w "%{http_code}" -X DELETE -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/releases/assets/$release_asset_id")
164+
if [ "$res" -eq 204 ]; then echo 1; else echo 0; fi
165+
}
136166

137167

138168
function git_branch_exists(){ # git_branch_exists <repo-path> <branch-name>

‎tools/cron.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/bash
22

3-
if [ ! "$GITHUB_EVENT_NAME" == "schedule" ]; then
4-
echo "Wrong event '$GITHUB_EVENT_NAME'!"
5-
exit 1
3+
if [ -z "$TARGET" ]; then
4+
TARGET="all"
65
fi
76

8-
bash ./build.sh -d
7+
bash ./build.sh -e -t $TARGET

‎tools/install-arduino.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,3 @@ if [ "$AR_BRANCH" ]; then
4646
git -C "$AR_COMPS/arduino" pull --ff-only
4747
fi
4848
if [ $? -ne 0 ]; then exit 1; fi
49-
50-
#
51-
# CLONE/UPDATE ESP32-ARDUINO-LIBS
52-
#
53-
if [ ! -d "$IDF_LIBS_DIR" ]; then
54-
echo "Cloning esp32-arduino-libs..."
55-
git clone "$AR_LIBS_REPO_URL" "$IDF_LIBS_DIR"
56-
else
57-
echo "Updating esp32-arduino-libs..."
58-
git -C "$IDF_LIBS_DIR" fetch && \
59-
git -C "$IDF_LIBS_DIR" pull --ff-only
60-
fi
61-
if [ $? -ne 0 ]; then exit 1; fi
62-

‎tools/install-esp-idf.sh

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -49,52 +49,3 @@ fi
4949
#
5050

5151
source $IDF_PATH/export.sh
52-
53-
#
54-
# SETUP ARDUINO DEPLOY
55-
#
56-
57-
if [ "$GITHUB_EVENT_NAME" == "schedule" ] || [ "$GITHUB_EVENT_NAME" == "repository_dispatch" -a "$GITHUB_EVENT_ACTION" == "deploy" ]; then
58-
# format new branch name and pr title
59-
if [ -x $commit_predefined ]; then #commit was not specified at build time
60-
AR_NEW_BRANCH_NAME="idf-$IDF_BRANCH"
61-
AR_NEW_COMMIT_MESSAGE="IDF $IDF_BRANCH $IDF_COMMIT"
62-
AR_NEW_PR_TITLE="IDF $IDF_BRANCH"
63-
else
64-
AR_NEW_BRANCH_NAME="idf-$IDF_COMMIT"
65-
AR_NEW_COMMIT_MESSAGE="IDF $IDF_COMMIT"
66-
AR_NEW_PR_TITLE="$AR_NEW_COMMIT_MESSAGE"
67-
fi
68-
LIBS_VERSION="idf-"${IDF_BRANCH//\//_}"-$IDF_COMMIT"
69-
70-
AR_HAS_COMMIT=`git_commit_exists "$AR_COMPS/arduino" "$AR_NEW_COMMIT_MESSAGE"`
71-
AR_HAS_BRANCH=`git_branch_exists "$AR_COMPS/arduino" "$AR_NEW_BRANCH_NAME"`
72-
AR_HAS_PR=`github_pr_exists "$AR_REPO" "$AR_NEW_BRANCH_NAME"`
73-
74-
LIBS_HAS_COMMIT=`git_commit_exists "$IDF_LIBS_DIR" "$AR_NEW_COMMIT_MESSAGE"`
75-
LIBS_HAS_BRANCH=`git_branch_exists "$IDF_LIBS_DIR" "$AR_NEW_BRANCH_NAME"`
76-
77-
if [ "$LIBS_HAS_COMMIT" == "1" ]; then
78-
echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in esp32-arduino-libs"
79-
fi
80-
81-
if [ "$AR_HAS_COMMIT" == "1" ]; then
82-
echo "Commit '$AR_NEW_COMMIT_MESSAGE' Already Exists in arduino-esp32"
83-
fi
84-
85-
if [ "$LIBS_HAS_COMMIT" == "1" ] && [ "$AR_HAS_COMMIT" == "1" ]; then
86-
exit 0
87-
fi
88-
89-
export AR_NEW_BRANCH_NAME
90-
export AR_NEW_COMMIT_MESSAGE
91-
export AR_NEW_PR_TITLE
92-
93-
export AR_HAS_COMMIT
94-
export AR_HAS_BRANCH
95-
export AR_HAS_PR
96-
97-
export LIBS_VERSION
98-
export LIBS_HAS_COMMIT
99-
export LIBS_HAS_BRANCH
100-
fi

‎tools/push-to-arduino.sh

Lines changed: 91 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
#!/bin/bash
2-
source ./tools/config.sh
2+
3+
source ./tools/install-arduino.sh
34

45
if [ -x $GITHUB_TOKEN ]; then
56
echo "ERROR: GITHUB_TOKEN was not defined"
67
exit 1
78
fi
89

9-
if ! [ -d "$AR_COMPS/arduino" ]; then
10-
echo "ERROR: Target arduino folder does not exist!"
11-
exit 1
12-
fi
13-
1410
# setup git for pushing
1511
git config --global github.user "$GITHUB_ACTOR"
1612
git config --global user.name "$GITHUB_ACTOR"
@@ -24,87 +20,104 @@ git config --global user.email "$GITHUB_ACTOR@github.com"
2420
# esp32-arduino-libs
2521
#
2622

27-
if [ $LIBS_HAS_COMMIT == "0" ] || [ $AR_HAS_COMMIT == "0" ]; then
23+
LIBS_ZIP_FILENAME="esp32-arduino-libs-$LIBS_VERSION.zip"
24+
LIBS_JSON_FILENAME="package-$LIBS_VERSION.json"
25+
IDF_LIBS_ZIP_URL="https://github.com/$AR_LIBS_REPO/releases/download/$LIBS_RELEASE_TAG/$LIBS_ZIP_FILENAME"
26+
IDF_LIBS_JSON_URL="https://github.com/$AR_LIBS_REPO/releases/download/$LIBS_RELEASE_TAG/$LIBS_JSON_FILENAME"
27+
28+
if [ $AR_HAS_COMMIT == "0" ] || [ $LIBS_HAS_ASSET == "0" ]; then
2829
cd "$AR_ROOT"
29-
# create branch if necessary
30-
if [ "$LIBS_HAS_BRANCH" == "1" ]; then
31-
echo "Branch '$AR_NEW_BRANCH_NAME' Already Exists"
32-
echo "Switching to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..."
33-
git -C "$IDF_LIBS_DIR" checkout $AR_NEW_BRANCH_NAME
34-
else
35-
echo "Creating esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..."
36-
git -C "$IDF_LIBS_DIR" checkout -b $AR_NEW_BRANCH_NAME
30+
mkdir -p dist
31+
32+
# check if the release exists
33+
if [ $LIBS_HAS_RELEASE == "0" ]; then
34+
echo "Release for tag \"$LIBS_RELEASE_TAG\" not found. Please create the release first."
35+
exit 1
3736
fi
38-
if [ $? -ne 0 ]; then
39-
echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed"
37+
38+
# Delete old assets for the version
39+
if [ $LIBS_HAS_ASSET == "1" ]; then
40+
echo "Deleting existing assets for version '$LIBS_VERSION'..."
41+
if [ `github_release_asset_delete "$AR_LIBS_REPO" "$LIBS_ASSET_ID"` == "0" ]; then
42+
echo "ERROR: Failed to delete asset '$LIBS_ZIP_FILENAME'"
43+
fi
44+
JSON_ASSET_ID=`github_release_asset_id "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_JSON_FILENAME"`
45+
if [ "$JSON_ASSET_ID" != "" ] && [ `github_release_asset_delete "$AR_LIBS_REPO" "$JSON_ASSET_ID"` == "0" ]; then
46+
echo "ERROR: Failed to delete asset '$LIBS_JSON_FILENAME'"
47+
fi
48+
fi
49+
50+
echo "Creating asset '$LIBS_ZIP_FILENAME'..."
51+
52+
mv -f "dist/esp32-arduino-libs.zip" "dist/$LIBS_ZIP_FILENAME"
53+
LIBS_ASSET_ID=`github_release_asset_upload "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_ZIP_FILENAME" "dist/$LIBS_ZIP_FILENAME"`
54+
if [ -z "$LIBS_ASSET_ID" ]; then
55+
echo "ERROR: Failed to upload asset '$LIBS_ZIP_FILENAME'"
4056
exit 1
4157
fi
4258

43-
# make changes to the files
44-
echo "Patching files in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..."
45-
rm -rf $IDF_LIBS_DIR/* && cp -Rf $AR_TOOLS/esp32-arduino-libs/* $IDF_LIBS_DIR/
46-
47-
cd $IDF_LIBS_DIR
48-
if [ -f "README.md" ]; then
49-
rm -rf "README.md"
59+
echo "Finished uploading asset '$LIBS_ZIP_FILENAME'. Asset ID: $LIBS_ASSET_ID"
60+
61+
# Calculate the local file checksum and size
62+
local_checksum=$(sha256sum "dist/$LIBS_ZIP_FILENAME" | awk '{print $1}')
63+
local_size=$(stat -c%s "dist/$LIBS_ZIP_FILENAME")
64+
65+
echo "Downloading asset '$LIBS_ZIP_FILENAME' and checking integrity..."
66+
67+
# Download the file
68+
remote_file="remote-$LIBS_ZIP_FILENAME"
69+
curl -s -L -o "$remote_file" "$IDF_LIBS_ZIP_URL"
70+
71+
# Check if the download was successful
72+
if [ $? -ne 0 ]; then
73+
echo "Error downloading file from $IDF_LIBS_ZIP_URL"
74+
exit 1
5075
fi
5176

52-
# did any of the files change?
53-
if [ -n "$(git status --porcelain)" ]; then
54-
echo "Pushing changes to esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'..."
55-
git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME
56-
if [ $? -ne 0 ]; then
57-
echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed"
58-
exit 1
59-
fi
60-
IDF_LIBS_COMMIT=`git rev-parse --verify HEAD`
61-
IDF_LIBS_DL_URL="https://codeload.github.com/espressif/esp32-arduino-libs/zip/$IDF_LIBS_COMMIT"
62-
# ToDo: this URL needs to get into Arduino's package.json
77+
# Calculate the remote file checksum and size
78+
remote_checksum=$(sha256sum "$remote_file" | awk '{print $1}')
79+
remote_size=$(stat -c%s "$remote_file")
6380

64-
# Download the file
65-
filename="esp32-arduino-libs-$IDF_LIBS_COMMIT.zip"
66-
curl -s -o "$filename" "$IDF_LIBS_DL_URL"
81+
echo "Local: $local_size bytes, $local_checksum"
82+
echo "Remote: $remote_size bytes, $remote_checksum"
6783

68-
# Check if the download was successful
69-
if [ $? -ne 0 ]; then
70-
echo "Error downloading file from $IDF_LIBS_DL_URL"
71-
exit 1
84+
# Check if the checksums match
85+
if [ "$local_checksum" != "$remote_checksum" ]; then
86+
echo "Checksum mismatch for downloaded file"
87+
echo "Deleting asset and exiting..."
88+
if [ `github_release_asset_delete "$AR_LIBS_REPO" "$LIBS_ASSET_ID"` == "0" ]; then
89+
echo "ERROR: Failed to delete asset '$LIBS_ZIP_FILENAME'"
7290
fi
91+
exit 1
92+
fi
7393

74-
# Calculate the size in bytes and SHA-256 sum
75-
size=$(stat -c%s "$filename")
76-
sha256sum=$(sha256sum "$filename" | awk '{print $1}')
77-
78-
# Clean up the downloaded file
79-
rm "$filename"
80-
81-
# Print the results
82-
echo "Tool: esp32-arduino-libs"
83-
echo "Version: $LIBS_VERSION"
84-
echo "URL: $IDF_LIBS_DL_URL"
85-
echo "File: $filename"
86-
echo "Size: $size bytes"
87-
echo "SHA-256: $sha256sum"
88-
echo "JSON: $AR_OUT/package_esp32_index.template.json"
89-
cd "$AR_ROOT"
90-
python3 tools/add_sdk_json.py -j "$AR_OUT/package_esp32_index.template.json" -n "esp32-arduino-libs" -v "$LIBS_VERSION" -u "$IDF_LIBS_DL_URL" -f "$filename" -s "$size" -c "$sha256sum"
91-
if [ $? -ne 0 ]; then exit 1; fi
94+
# Clean up the downloaded file
95+
rm "$remote_file"
96+
97+
# Print the results
98+
echo "Tool: esp32-arduino-libs"
99+
echo "Version: $LIBS_VERSION"
100+
echo "URL: $IDF_LIBS_ZIP_URL"
101+
echo "File: $LIBS_ZIP_FILENAME"
102+
echo "Size: $local_size bytes"
103+
echo "SHA-256: $local_checksum"
104+
echo "JSON: $AR_OUT/package_esp32_index.template.json"
105+
cd "$AR_ROOT"
106+
python3 tools/add_sdk_json.py -j "$AR_OUT/package_esp32_index.template.json" -n "esp32-arduino-libs" -v "$LIBS_VERSION" -u "$IDF_LIBS_ZIP_URL" -f "$LIBS_ZIP_FILENAME" -s "$local_size" -c "$local_checksum"
107+
if [ $? -ne 0 ]; then exit 1; fi
92108

93-
else
94-
echo "No changes in esp32-arduino-libs branch '$AR_NEW_BRANCH_NAME'"
95-
if [ $LIBS_HAS_BRANCH == "0" ]; then
96-
echo "Delete created branch '$AR_NEW_BRANCH_NAME'"
97-
git branch -d $AR_NEW_BRANCH_NAME
98-
fi
99-
exit 0
109+
JSON_ASSET_ID=`github_release_asset_upload "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_JSON_FILENAME" "$AR_OUT/package_esp32_index.template.json"`
110+
if [ -z "$JSON_ASSET_ID" ]; then
111+
echo "ERROR: Failed to upload asset '$LIBS_JSON_FILENAME'"
112+
exit 1
100113
fi
101114
fi
102115

103116
#
104117
# esp32-arduino
105118
#
106119

107-
if [ $AR_HAS_COMMIT == "0" ]; then
120+
if [ $AR_HAS_COMMIT == "0" ] || [ $LIBS_HAS_ASSET == "0" ]; then
108121
cd "$AR_ROOT"
109122
# create or checkout the branch
110123
if [ ! $AR_HAS_BRANCH == "0" ]; then
@@ -115,31 +128,31 @@ if [ $AR_HAS_COMMIT == "0" ]; then
115128
git -C "$AR_COMPS/arduino" checkout -b $AR_NEW_BRANCH_NAME
116129
fi
117130
if [ $? -ne 0 ]; then
118-
echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed"
131+
echo "ERROR: Checkout of branch '$AR_NEW_BRANCH_NAME' failed"
119132
exit 1
120133
fi
121134

122135
# make changes to the files
123136
echo "Patching files in branch '$AR_NEW_BRANCH_NAME'..."
124137
rm -rf "$AR_COMPS/arduino/package/package_esp32_index.template.json" && cp -f "$AR_OUT/package_esp32_index.template.json" "$AR_COMPS/arduino/package/package_esp32_index.template.json"
125-
138+
126139
cd $AR_COMPS/arduino
127140

128141
# did any of the files change?
129142
if [ -n "$(git status --porcelain)" ]; then
130143
echo "Pushing changes to branch '$AR_NEW_BRANCH_NAME'..."
131-
git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME
144+
git add . && git commit --message "$AR_NEW_COMMIT_MESSAGE" && git push -u origin $AR_NEW_BRANCH_NAME
132145
if [ $? -ne 0 ]; then
133-
echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed"
146+
echo "ERROR: Pushing to branch '$AR_NEW_BRANCH_NAME' failed"
134147
exit 1
135148
fi
136149
else
137-
echo "No changes in branch '$AR_NEW_BRANCH_NAME'"
138-
if [ $AR_HAS_BRANCH == "0" ]; then
139-
echo "Delete created branch '$AR_NEW_BRANCH_NAME'"
140-
git branch -d $AR_NEW_BRANCH_NAME
141-
fi
142-
exit 0
150+
echo "No changes in branch '$AR_NEW_BRANCH_NAME'"
151+
if [ $AR_HAS_BRANCH == "0" ]; then
152+
echo "Delete created branch '$AR_NEW_BRANCH_NAME'"
153+
git branch -d $AR_NEW_BRANCH_NAME
154+
fi
155+
exit 0
143156
fi
144157

145158
# CREATE PULL REQUEST

0 commit comments

Comments
 (0)
Please sign in to comment.