Skip to content

Commit

Permalink
Merge pull request #8 from DeployGate/add_fixture
Browse files Browse the repository at this point in the history
Bump up version
  • Loading branch information
jmatsu authored Feb 6, 2020
2 parents eaee80a + 33b4bcf commit 3339182
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
_tmp/

.idea/
upload-app-bitrise-step.iml
upload-app-bitrise-step.iml
26 changes: 17 additions & 9 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ app:

# If you want to share this step into a StepLib
- BITRISE_STEP_ID: deploygate--upload-app-bitrise-step
- BITRISE_STEP_VERSION: "1.0.1"
- BITRISE_STEP_VERSION: "1.1.0"
- BITRISE_STEP_GIT_CLONE_URL: https://github.com/DeployGate/upload-app-bitrise-step.git
- MY_STEPLIB_REPO_FORK_GIT_URL: "https://github.com/DeployGate/bitrise-steplib"

Expand Down Expand Up @@ -66,8 +66,16 @@ workflows:
inputs:
- api_key: "$TEST_PAID_API_KEY"
- owner_name: "$TEST_PAID_OWNER_NAME"
- app_path: sample.apk
- app_path: ../fixture/sample.apk
- message: "via Bitrise CLI test"
- script:
title: Check if the previous step has added a response to envman properly
run_if: true
inputs:
- content: |
#!/bin/bash
set -eu
echo "The response was: $DEPLOYGATE_UPLOAD_APP_STEP_RESULT_JSON"
- path::./:
title: Upload an application with a short message
description: |
Expand All @@ -76,7 +84,7 @@ workflows:
inputs:
- api_key: "$TEST_PAID_API_KEY"
- owner_name: "$TEST_PAID_OWNER_NAME"
- app_path: sample.apk
- app_path: ../fixture/sample.apk
- message: "via Bitrise CLI test"
- path::./:
title: Upload an application with a distribution name
Expand All @@ -86,7 +94,7 @@ workflows:
inputs:
- api_key: "$TEST_PAID_API_KEY"
- owner_name: "$TEST_PAID_OWNER_NAME"
- app_path: sample.apk
- app_path: ../fixture/sample.apk
- distribution_name: "BITRISE_CLI_TEST"
- path::./:
title: Upload an application with a distribution key
Expand All @@ -96,7 +104,7 @@ workflows:
inputs:
- api_key: "$TEST_PAID_API_KEY"
- owner_name: "$TEST_PAID_OWNER_NAME"
- app_path: sample.apk
- app_path: ../fixture/sample.apk
- distribution_key: "$TEST_DISTRIBUTION_KEY"
- path::./:
title: Upload an application with a visibility
Expand All @@ -106,7 +114,7 @@ workflows:
inputs:
- api_key: "$TEST_API_KEY"
- owner_name: "$TEST_OWNER_NAME"
- app_path: sample.apk
- app_path: ../fixture/sample.apk
- visibility: "public"
- path::./:
title: Upload an application with a release note
Expand All @@ -116,9 +124,9 @@ workflows:
inputs:
- api_key: "$TEST_PAID_API_KEY"
- owner_name: "$TEST_PAID_OWNER_NAME"
- app_path: sample.apk
- app_path: ../fixture/sample.apk
- distribution_name: "BITRISE_CLI_TEST"
- release_note: "distribution dayo"
- release_note: "Can you see me?"
- path::./:
title: Upload an application with disabling notififications
description: |
Expand All @@ -127,7 +135,7 @@ workflows:
inputs:
- api_key: "$TEST_PAID_API_KEY"
- owner_name: "$TEST_PAID_OWNER_NAME"
- app_path: sample.ipa
- app_path: ../fixture/sample.ipa
- disable_notify: "true"


Expand Down
Binary file added fixture/sample.apk
Binary file not shown.
Binary file added fixture/sample.ipa
Binary file not shown.
30 changes: 10 additions & 20 deletions step.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
#!/bin/bash

STEP_VERSION=1.0.1

set -ex
readonly STEP_VERSION=1.1.0
readonly output_file="output.json"

upload_app() {
set +ex

local -r all_fields=(
"file=@$app_path"
"message=$message"
Expand All @@ -30,13 +27,12 @@ upload_app() {
done

curl -# -X POST \
-o "$output_file" \
-H "Authorization: token $api_key" \
-H "Accept: application/json" \
-A "DeployGateUploadAppBitriseStep/$STEP_VERSION" \
"${fields[@]}" \
"https://deploygate.com/api/users/$owner_name/apps" > output.json

set -ex
return 0
"https://deploygate.com/api/users/$owner_name/apps"
}

parse_error_field() {
Expand All @@ -45,14 +41,8 @@ parse_error_field() {

upload_app # this will create the `output.json``

envman add --key DEPLOYGATE_UPLOAD_APP_STEP_RESULT_JSON --valuefile output.json

if [[ "$(cat output.json | parse_error_field)" == "false" ]]; then
# upload successfully
cat output.json
exit 0
else
# WTF
cat output.json
exit 1
fi
envman add --key DEPLOYGATE_UPLOAD_APP_STEP_RESULT_JSON --valuefile "$output_file"

cat "$output_file"

[[ "$(cat output.json | parse_error_field)" == "false" ]]
4 changes: 2 additions & 2 deletions step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ inputs:
- app_path: ""
opts:
title: "App file path"
summary: "App's binary file (IPA/APK) to be uploaded"
summary: "App's binary file (IPA/APK/AAB) to be uploaded"
description: |
App's binary file (IPA/APK) to be uploaded.
App's binary file (IPA/APK/AAB) to be uploaded.
$BITRISE\_APK\_PATH, $BITRISE\_IPA\_PATH, and so on.
is_required: true
- visibility: "private"
Expand Down

0 comments on commit 3339182

Please sign in to comment.