Skip to content

Commit

Permalink
Disable log formatting in notarized build workflow when run with debu…
Browse files Browse the repository at this point in the history
…g logging enabled (#1445)

Task/Issue URL: https://app.asana.com/0/1203301625297703/1205226517596953/f

Description:
Show raw logs when GitHub Actions debug logging is enabled when retrying a workflow.
  • Loading branch information
ayoy authored Aug 8, 2023
1 parent 01d9049 commit d8386a9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build_notarized.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ jobs:
submodules: recursive

- name: Install xcbeautify
if: runner.debug != '1'
continue-on-error: true
run: brew install xcbeautify

Expand All @@ -198,7 +199,11 @@ jobs:
export APPLE_API_KEY_PATH="$RUNNER_TEMP/apple_api_key.pem"
echo -n "$APPLE_API_KEY_BASE64" | base64 --decode -o $APPLE_API_KEY_PATH
./scripts/archive.sh ${{ env.release-type }}
if [[ "${{ runner.debug }}" == "1" ]]; then
./scripts/archive.sh ${{ env.release-type }} -r
else
./scripts/archive.sh ${{ env.release-type }}
fi
- name: Set app name and version
id: set-outputs
Expand Down
15 changes: 12 additions & 3 deletions scripts/archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ print_usage_and_exit() {

cat <<- EOF
Usage:
$ $(basename "$0") <review|release|review-sandbox|release-sandbox> [-a <asana_task_url>] [-d] [-s] [-v <version>]
$ $(basename "$0") <review|release|review-sandbox|release-sandbox> [-a <asana_task_url>] [-d] [-s] [-r] [-v <version>]
Options:
-a <asana_task_url> Update Asana task after building the app (implies -d)
-d Create a DMG image alongside the zipped app and dSYMs
-h Print this message
-r Show raw output (don't use xcpretty or xcbeautify)
-s Skip xcodebuild output in logs
-v <version> Override app version with <version> (does not update Xcode project)
Expand Down Expand Up @@ -68,7 +69,7 @@ read_command_line_arguments() {

shift 1

while getopts 'a:dhsv:' OPTION; do
while getopts 'a:dhrsv:' OPTION; do
case "${OPTION}" in
a)
asana_task_url="${OPTARG}"
Expand All @@ -82,6 +83,9 @@ read_command_line_arguments() {
h)
print_usage_and_exit
;;
r)
disable_log_formatting=1
;;
s)
# Use silent_output function to redirect all output to /dev/null
filter_output='silent_output'
Expand Down Expand Up @@ -197,7 +201,12 @@ prepare_export_options_plist() {
}

setup_log_formatter() {
if command -v xcbeautify &> /dev/null; then
if [[ ${disable_log_formatting} ]]; then
echo
echo "Log formatting disabled - not prettifying Xcode logs."
echo
log_formatter='tee'
elif command -v xcbeautify &> /dev/null; then
log_formatter='xcbeautify'
elif command -v xcpretty &> /dev/null; then
log_formatter='xcpretty'
Expand Down

0 comments on commit d8386a9

Please sign in to comment.