Skip to content

Commit c68d2cc

Browse files
committed
use GITHUB_ACTION to update profile expire date
1 parent dae9b62 commit c68d2cc

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Scripts/capture-build-details.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ if [ -e "${provisioning_profile_path}" ]; then
7272
profile_expire_date=$(security cms -D -i "${provisioning_profile_path}" | plutil -p - | grep ExpirationDate | cut -b 23-)
7373
# Convert to plutil format
7474
profile_expire_date=$(date -j -f "%Y-%m-%d %H:%M:%S" "${profile_expire_date}" +"%Y-%m-%dT%H:%M:%SZ")
75+
# Handle github action, testflight builds that expire <= 90 days
76+
if [ -n "$GITHUB_ACTIONS" ]; then
77+
github_expire_date=$(date -j -v+90d +"%Y-%m-%dT%H:%M:%SZ")
78+
79+
if [ "$(date -j -f "%Y-%m-%dT%H:%M:%SZ" "${github_expire_date}" +%s)" -lt "$(date -j -f "%Y-%m-%dT%H:%M:%SZ" "${profile_expire_date}" +%s)" ]; then
80+
profile_expire_date=$github_expire_date
81+
else
82+
echo "GitHub Actions detected, expiration date is not more than 90 days in the future."
83+
fi
84+
fi
85+
7586
plutil -replace com-loopkit-Loop-profile-expiration -date "${profile_expire_date}" "${info_plist_path}"
7687
else
7788
warn "Invalid provisioning profile path ${provisioning_profile_path}"
@@ -89,14 +100,5 @@ then
89100
if [ -n "$branch" ]; then
90101
plutil -replace com-loopkit-LoopWorkspace-git-branch -string "${branch}" "${info_plist_path}"
91102
fi
92-
# determine if this is a GitHub Action build (with 90 day expiration)
93-
folderName=$(pwd)
94-
runnerString="/Users/runner"
95-
if [ "${folderName:0:13}" == "$runnerString" ]; then
96-
# overwrite profile_expire_date
97-
profile_expire_date=$(date -j -v+90d +"%Y-%m-%dT%H:%M:%SZ")
98-
echo "runnerString detected, update profile_expire_date to ${profile_expire_date}"
99-
plutil -replace com-loopkit-Loop-profile-expiration -date "${profile_expire_date}" "${info_plist_path}"
100-
fi
101103
popd . > /dev/null
102104
fi

0 commit comments

Comments
 (0)