Skip to content

Commit

Permalink
Adaptation to v3 API
Browse files Browse the repository at this point in the history
  • Loading branch information
CesarTrigo committed May 30, 2019
1 parent d464399 commit 46fc297
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 83 deletions.
6 changes: 2 additions & 4 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ app:
envs:
# define these in your .bitrise.secrets.yml
- APK_PATH: $APK_PATH
- API_TOKEN: $APPLIVERY_API_TOKEN
- APP_ID: $APPLIVERY_APP_ID
- APP_TOKEN: $APPLIVERY_APP_TOKEN

workflows:
test:
Expand All @@ -19,8 +18,7 @@ workflows:
- path::./:
inputs:
- apk_path: "${$APK_PATH}"
- api_token: "${APPLIVERY_API_TOKEN}"
- app_id: "${APPLIVERY_APP_ID}"
- appToken: "${APPLIVERY_APP_TOKEN}"
- script:
title: Output (generated by the Step) tests
inputs:
Expand Down
88 changes: 42 additions & 46 deletions step.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

echo "=> Starting Applivery Android Deploy"
echo "=> Starting Applivery v3 Android Deploy"

THIS_SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

Expand All @@ -22,17 +22,9 @@ if [ ! -f "${apk_path}" ] ; then
fi

# APPLIVERY API TOKEN
if [ -z "${api_token}" ] ; then
if [ -z "${appToken}" ] ; then
echo "# Error"
echo '* No APPLIVERY_API_TOKEN provided as environment variable. Terminating...'
echoStatusFailed
exit 1
fi

# APPLIVER APP ID
if [ -z "${app_id}" ] ; then
echo "# Error"
echo '* No APPLIVERY_APP_ID provided as environment variable. Terminating...'
echo '* No App Token provided as environment variable. Terminating...'
echoStatusFailed
exit 1
fi
Expand All @@ -50,50 +42,54 @@ bitrise_git_commit="${BITRISE_GIT_COMMIT}"
bitrise_git_message="${BITRISE_GIT_MESSAGE}"

echo
echo "========== CONFIGS =========="
echo "* api_token: ********"
echo "* app_id: ${app_id}"
echo "* version_name: ${version_name}"
echo "* notes: ${notes}"
echo "* notify: ${notify}"
echo "* autoremove: ${autoremove}"
echo "* os: ${os}"
echo "========== CONFIGURATION =========="
echo "* appToken: *****************"
echo "* app_id: deprecated"
echo "* version_name: ${versionName}"
echo "* changelog: ${changelog}"
echo "* notifyCollaborators: ${notifyCollaborators}"
echo "* notifyEmployees: ${notifyEmployees}"
echo "* notifyMessage: ${notifyMessage}"
echo "* autoremove: deprecated"
echo "* os: deprecated"
echo "* tags: ${tags}"
echo "* apk_path: ${apk_path}"
echo "***** Other variables *****"
echo "* bitrise_build_number: ${bitrise_build_number}"
echo "* git_repository_url: ${git_repository_url}"
echo "* bitrise_app_url: ${bitrise_app_url}"
echo "* bitrise_build_url: ${bitrise_build_url}"
echo "* bitrise_build_trigger_timestamp: ${bitrise_build_trigger_timestamp}"
echo "* bitrise_git_branch: ${bitrise_git_branch}"
echo "* bitrise_git_tag: ${bitrise_git_tag}"
echo "* bitrise_git_commit: ${bitrise_git_commit}"
echo "* bitrise_git_message: ${bitrise_git_message}"
echo
echo "========== DEPLOYMENT VALUES =========="
echo "* commitMessage: ${commitMessage}"
echo "* commit: ${commit}"
echo "* branch: ${branch}"
echo "* tag: ${tag}"
echo "* triggerTimestamp: ${triggerTimestamp}"
echo "* buildUrl: ${buildUrl}"
echo "* ciUrl: ${ciUrl}"
echo "* repositoryUrl: ${repositoryUrl}"
echo "* buildNumber: ${buildNumber}"


echo

###########################

curl_cmd="curl --fail"
curl_cmd="$curl_cmd -H \"Authorization: ${api_token}\""
curl_cmd="$curl_cmd -F \"app=${app_id}\""
curl_cmd="$curl_cmd -F \"versionName=${version_name}\""
curl_cmd="$curl_cmd -F \"notes=${notes}\""
curl_cmd="$curl_cmd -F \"notify=${notify}\""
curl_cmd="$curl_cmd -F \"autoremove=${autoremove}\""
curl_cmd="$curl_cmd -H \"Authorization: ${appToken}\""
curl_cmd="$curl_cmd -F \"versionName=${versionName}\""
curl_cmd="$curl_cmd -F \"changelog=${changelog}\""
curl_cmd="$curl_cmd -F \"notifyCollaborators=${notifyCollaborators}\""
curl_cmd="$curl_cmd -F \"notifyEmployees=${notifyEmployees}\""
curl_cmd="$curl_cmd -F \"os=android\""
curl_cmd="$curl_cmd -F \"deployer=bitrise\""
curl_cmd="$curl_cmd -F \"tags=${tags}\""
curl_cmd="$curl_cmd -F \"package=@${apk_path}\""
curl_cmd="$curl_cmd -F \"bitrise_build_number=${bitrise_build_number}\""
curl_cmd="$curl_cmd -F \"git_repository_url=${git_repository_url}\""
curl_cmd="$curl_cmd -F \"bitrise_app_url=${bitrise_app_url}\""
curl_cmd="$curl_cmd -F \"bitrise_build_url=${bitrise_build_url}\""
curl_cmd="$curl_cmd -F \"bitrise_build_trigger_timestamp=${bitrise_build_trigger_timestamp}\""
curl_cmd="$curl_cmd -F \"bitrise_git_branch=${bitrise_git_branch}\""
curl_cmd="$curl_cmd -F \"bitrise_git_tag=${bitrise_git_tag}\""
curl_cmd="$curl_cmd -F \"bitrise_git_commit=${bitrise_git_commit}\""
curl_cmd="$curl_cmd -F \"bitrise_git_message=${bitrise_git_message}\""
curl_cmd="$curl_cmd -F \"build=@${apk_path}\""
curl_cmd="$curl_cmd -F \"deployer=bitrise\""
curl_cmd="$curl_cmd -F \"commitMessage=${commitMessage}\""
curl_cmd="$curl_cmd -F \"commit=${commit}\""
curl_cmd="$curl_cmd -F \"branch=${branch}\""
curl_cmd="$curl_cmd -F \"tag=${tag}\""
curl_cmd="$curl_cmd -F \"triggerTimestamp=${triggerTimestamp}\""
curl_cmd="$curl_cmd -F \"buildUrl=${buildUrl}\""
curl_cmd="$curl_cmd -F \"ciUrl=${ciUrl}\""
curl_cmd="$curl_cmd -F \"repositoryUrl=${repositoryUrl}\""
curl_cmd="$curl_cmd -F \"buildNumber=${buildNumber}\""
curl_cmd="$curl_cmd https://dashboard.applivery.com/api/builds"

echo
Expand Down
57 changes: 24 additions & 33 deletions step.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
title: "Applivery.com Android Deploy"
summary: Deploy your awesome Android Application to Applivery.com
title: "Applivery.com v3 Android Deploy"
summary: Deploy your awesome Android App to Applivery.com
description: |-
Deploy an Android application to [Applivery](http://www.applivery.com),
add notes and notify testers.
add notes and notify Collaborators and Employees.
Register a Applivery account at [http://www.applivery..com/](http://www.applivery.com)
and create an App to utilize this step.
You also need to get your *Account API Key* for you account and the *App Id* for the app.
You also need to get your *App Token* of your App that can be found under your App Settings.
website: https://github.com/applivery/steps-applivery-android-deploy
source_code_url: https://github.com/applivery/steps-applivery-android-deploy
support_url: https://github.com/applivery/steps-applivery-android-deploy/issues
Expand All @@ -30,58 +30,49 @@ inputs:
summary: ""
description: ""
is_required: true
- api_token: "$APPLIVERY_API_TOKEN"
- appToken: "$APPLIVERY_APP_TOKEN"
opts:
title: "Account API Key"
title: "App Token"
summary: ""
description: |-
This is the API Key to access your account.
This is your App Token
## Where to get the Applivery Account API Key?
Sign in to your [Applivery.com](http://dashboard.applivery.com) account,
click on Developers menu option from the left side menu and copy it from the
Account API Key section.
Sign in to your [Applivery](http://dashboard.applivery.io) account,
click on your App and the navigate to the Settings menu option. Scroll down to the Integrations section and click on New Token button to generate a new token. Then, copy & paste it here. [Read more](https://www.applivery.com/docs/rest-api/authentication/)
is_required: true
- app_id: "$APPLIVERY_APP_ID"
- changelog: ""
opts:
title: "Applivery: App ID"
title: "(Optional) Changelog or release notes"
summary: ""
description: |-
This is the App Id that identifies your App in Applivery.com
## Where to get the App Id?
Sign in to your [Applivery.com](http://dashboard.applivery.com) account,
click on Applications menu option from the left side menu, click on the desired App.
You'll find the App Id inside the (i) information block (written in red).
is_required: false
- notes: "Deployed with Bitrise Applivery.com Android Deploy Step."
description: "Additional build/release notes or changelog attached to the deploy"
- notifyCollaborators: "true"
opts:
title: "Notes attached to the deploy"
title: "Notify Collaborators?"
summary: ""
description: "Additional build/release notes"
- notify: "true"
description: "This flag allows you to automatically notify your project Collaborators vía email."
value_options: ["true", "false"]
is_required: true
- notifyEmployees: "true"
opts:
title: "Notify Testers?"
title: "Notify Employees?"
summary: ""
description: "This flag allows you to automatically notify your testers vía email."
description: "This flag allows you to automatically notify your project Employees vía email."
value_options: ["true", "false"]
is_required: true
- autoremove: "true"
- notifyMessage: ""
opts:
title: "Automatically remove the oldest build?"
title: "(Optional) Notification message"
summary: ""
description: "Automatically remove the oldest build before uploading a new one to prevent reaching your account limits."
value_options: ["true", "false"]
is_required: false
description: "Notification message to be sent along with the email notification"
- tags: ""
opts:
title: "(Optional) Comma-separated list of tags"
summary: ""
description: "Comma-separated list of tags to easily identify the build"
is_required: false
- version_name: ""
- versionName: ""
opts:
title: "(Optional) Human readable version name"
summary: ""
Expand Down

0 comments on commit 46fc297

Please sign in to comment.