diff --git a/iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/gpowell.xcuserdatad/UserInterfaceState.xcuserstate b/iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/gpowell.xcuserdatad/UserInterfaceState.xcuserstate index f79681c..063e4f6 100644 Binary files a/iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/gpowell.xcuserdatad/UserInterfaceState.xcuserstate and b/iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/gpowell.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/scripts/build-number.sh b/scripts/build-number.sh index db6c979..eb28f4f 100755 --- a/scripts/build-number.sh +++ b/scripts/build-number.sh @@ -1,15 +1,16 @@ #!/bin/bash -TAGS=$(git show-ref --tags) +set -xe function getBuildNumberTag { set +e - echo "$TAGS"| grep "${1:-}" | grep -oE 'build-number-[[:digit:]]+' | grep -oE '[[:digit:]]+' | sort -nr | head -1 + git fetch --tags + git show-ref --tags | grep "${1:-}" | grep -oE 'build-number-[[:digit:]]+' | grep -oE '[[:digit:]]+' | sort -nr | head -1 set -e } CURRENT_BUILD_NUMBER=$(getBuildNumberTag "$INPUT_SHA") -OUT=$(echo "$TAGS" | grep -oE 'build-number-[[:digit:]]+') +OUT=$(git show-ref --tags | grep -oE 'build-number-[[:digit:]]+') echo "$OUT" if [[ -z "${CURRENT_BUILD_NUMBER}" ]]; then @@ -24,17 +25,23 @@ if [[ -z "${CURRENT_BUILD_NUMBER}" ]]; then fi CURRENT_BUILD_NUMBER="$((LATEST_BUILD_NUMBER + 1))" - git tag "build-number-$CURRENT_BUILD_NUMBER" - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" + CHECK_BUILD_NUMBER=$(getBuildNumberTag "build-number-$CURRENT_BUILD_NUMBER") + if [[ -z "$CHECK_BUILD_NUMBER" ]]; then + git tag "build-number-$CURRENT_BUILD_NUMBER" "$INPUT_SHA" - GITHUB_URL_PROTOCOL=$(echo "$GITHUB_SERVER_URL" | sed -e 's,^\(.*://\).*,\1,g') - GITHUB_URL_HOST=$(echo "$GITHUB_SERVER_URL" | sed -e 's,^.*://\(.*\),\1,g') + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" - echo "Pushing build number tag build-number-$CURRENT_BUILD_NUMBER to Github ($GITHUB_REF)." + GITHUB_URL_PROTOCOL=$(echo "$GITHUB_SERVER_URL" | sed -e 's,^\(.*://\).*,\1,g') + GITHUB_URL_HOST=$(echo "$GITHUB_SERVER_URL" | sed -e 's,^.*://\(.*\),\1,g') - git push "${GITHUB_URL_PROTOCOL}${INPUT_GITHUB_TOKEN}@${GITHUB_URL_HOST}/${GITHUB_REPOSITORY}.git" --tags + echo "Pushing build number tag build-number-$CURRENT_BUILD_NUMBER to Github ($INPUT_SHA)." + git push "${GITHUB_URL_PROTOCOL}${INPUT_GITHUB_TOKEN}@${GITHUB_URL_HOST}/${GITHUB_REPOSITORY}.git" --tags + else + CURRENT_BUILD_NUMBER=$(getBuildNumberTag "$INPUT_SHA") + echo "Build number changed for current SHA $INPUT_SHA. Using origin build number $CURRENT_BUILD_NUMBER." + fi else echo "Found build number $CURRENT_BUILD_NUMBER for current SHA $INPUT_SHA." echo "Skipping tag creation."