Skip to content

Commit b8a1e1c

Browse files
committed
prevent failure
1 parent 7fb1616 commit b8a1e1c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/workflows/update-libs.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ jobs:
2828
LATEST_RELEASE=${{ steps.get-latest-version.outputs.LATEST_RELEASE }}
2929
if git ls-remote --heads origin update-bricks-${LATEST_RELEASE} | grep -q update-bricks-${LATEST_RELEASE}; then
3030
echo "Branch update-bricks-${LATEST_RELEASE} already exists."
31-
exit 1
31+
echo "branch_exists=true" >> $GITHUB_OUTPUT
3232
fi
3333
3434
- name: Check if current version is up to date
35-
if: steps.check-branch.outcome == 'success'
35+
if: steps.check-branch.outputs.branch_exists != 'true'
3636
id: check-update
3737
run: |
3838
LATEST_RELEASE=${{ steps.get-latest-version.outputs.LATEST_RELEASE }}
@@ -41,26 +41,27 @@ jobs:
4141
echo "CURRENT_VERSION=$CURRENT_VERSION"
4242
if [ "$CURRENT_VERSION" = "$LATEST_RELEASE" ]; then
4343
echo "No update needed. Current version is up to date."
44-
exit 1
44+
echo "update_needed=false" >> $GITHUB_OUTPUT
45+
exit 0
4546
fi
4647
fi
4748
echo "Update needed. Current version is outdated or not present."
4849
4950
- name: Download whl file
50-
if: steps.check-update.outcome == 'success'
51+
if: steps.check-update.outputs.update_needed != 'false'
5152
run: |
5253
LATEST_RELEASE=${{ steps.get-latest-version.outputs.LATEST_RELEASE }}
5354
ASSET_URL=$(curl -s https://api.github.com/repos/arduino/app-bricks-py/releases/latest | jq -r '.assets[] | select(.name | endswith(".whl")) | .browser_download_url')
5455
wget "$ASSET_URL" -O libs/arduino_app_bricks-${LATEST_RELEASE}-py3-none-any.whl
5556
5657
- name: Remove old whl files
57-
if: steps.check-update.outcome == 'success'
58+
if: steps.check-update.outputs.update_needed != 'false'
5859
run: |
5960
LATEST_RELEASE=${{ steps.get-latest-version.outputs.LATEST_RELEASE }}
6061
find libs/ -name 'arduino_app_bricks-*.whl' ! -name "arduino_app_bricks-${LATEST_RELEASE}-py3-none-any.whl" -delete
6162
6263
- name: Commit and push whl file
63-
if: steps.check-update.outcome == 'success'
64+
if: steps.check-update.outputs.update_needed != 'false'
6465
run: |
6566
LATEST_RELEASE=${{ steps.get-latest-version.outputs.LATEST_RELEASE }}
6667
git config user.name "github-actions"

0 commit comments

Comments
 (0)