diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6c629d3 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,18 @@ +# Changelog + +All notable changes to this project will be documented in this file. The format +is based on [Keep a Changelog]. + +This project adheres to [Semantic Versioning]. + +## [Unreleased] + +## [1.0.0] - 2022-04-07 + +Initial public release. + +[Unreleased]: https://github.com/waldoapp/waldo-go-lib/compare/v1.0.0...HEAD +[1.0.0]: https://github.com/waldoapp/waldo-go-lib/compare/81e8b45...v1.0.0 + +[Keep a Changelog]: https://keepachangelog.com +[Semantic Versioning]: https://semver.org diff --git a/README.md b/README.md index 224037e..7b24727 100644 --- a/README.md +++ b/README.md @@ -1 +1,76 @@ # waldoapp/gh-action-upload + +This GitHub Action uploads your build (`.app`, `.ipa`, or `.apk`) to Waldo. + +You must specify at least a build path and a Waldo upload token. + +Typically the build path is generated by a previous build action in your +workflow. + +Each application registered in Waldo is associated with a unique upload token. +You can find the upload token for your app by going to the Documentation screen +for your app in [Waldo](https://app.waldo.io/). This token _should_ be +specified as a _secret_ environment variable. + +## Inputs + +- `build_path` + + The path to your `.app`, `.ipa`, or `.apk` build. Typically the build path is + generated by a previous build action in your workflow. **Required.** + +- `upload_token` + + The upload token associated with your app. Each application registered in + Waldo is associated with a unique upload token. **Required.** + +- `variant_name` + + An optional variant name. This is an arbitrary string to associate with this + build. + +- `git_commit` + + The originating git commit hash. This is the hash of the originating git + commit (also known as the “git SHA”) for this build. If omitted, Waldo + attempts to infer the git commit from the CI provider (if any) or from the + current git repository (if accessible). + +- `git_branch` + + The originating git commit branch name. This is the branch name (if any) of + the originating git commit for this build. If omitted, Waldo attempts to + infer the git branch name from the CI provider (if any) or from the current + git repository (if accessible). + +- `is_debug_mode` + + If this mode is enabled, additional debug information is printed. (Default: + `false`.) + +## Usage + +```yaml +steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Build with Xcode + run: | + DERIVED_DATA_PATH=/tmp/YourApp-$(uuidgen) + + xcodebuild -project YourApp.xcodeproj \ + -scheme YourApp \ + -configuration Release \ + -destination 'generic/platform=iOS Simulator' \ + -derivedDataPath "$DERIVED_DATA_PATH" \ + clean build + + echo "APP_DIR_PATH=${DERIVED_DATA_PATH}/Build/Products/Release-iphonesimulator/YourApp.app" >>$GITHUB_ENV + - name: Upload build to Waldo + uses: waldoapp/gh-action-upload@v1 + with: + build_path: ${{ env.APP_DIR_PATH }} + upload_token: ${{ secrets.WALDO_UPLOAD_TOKEN }} +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..55a7d06 --- /dev/null +++ b/action.yml @@ -0,0 +1,84 @@ +name: 'Upload to Waldo' +description: | + Uploads your build (`.app`, `.ipa`, or `.apk`) to Waldo. +inputs: + build_path: + description: > + The path to your `.app`, `.ipa`, or `.apk` build. Typically the build + path is generated by a previous build action in your workflow. + required: true + upload_token: + description: > + The upload token associated with your app. Each application registered in + Waldo is associated with a unique upload token. + required: true + variant_name: + description: > + An optional variant name. This is an arbitrary string to associate with + this build. + required: false + default: '' + git_commit: + description: > + The originating git commit hash. This is the hash of the originating git + commit (also known as the “git SHA”) for this build. If omitted, Waldo + attempts to infer the git commit from the CI provider (if any) or from + the current git repository (if accessible). + required: false + default: '' + git_branch: + description: > + The originating git commit branch name. This is the branch name (if any) + of the originating git commit for this build. If omitted, Waldo attempts + to infer the git branch name from the CI provider (if any) or from the + current git repository (if accessible). + required: false + default: '' + is_debug_mode: + description: > + If this mode is enabled, additional debug information is printed. + required: false + default: false +runs: + using: composite + steps: + - run: | + if [ ! -e ${WALDO_CLI_BIN}/waldo ]; then + bash -c "$(curl -fLs https://github.com/waldoapp/waldo-go-cli/raw/master/install-waldo.sh)" + fi + + build_path=${{ inputs.build_path }} + git_branch=${{ inputs.git_branch }} + git_commit=${{ inputs.git_commit }} + upload_token=${{ inputs.upload_token }} + variant_name=${{ inputs.variant_name }} + verbose=${{ inputs.is_debug_mode }} + + extra_options="" + + if [[ -n $variant_name ]]; then + extra_options="${extra_options} --variant_name \"${variant_name}\"" + fi + + if [[ -n $git_commit ]]; then + extra_options="${extra_options} --git_commit \"${git_commit}\"" + fi + + if [[ -n $git_branch ]]; then + extra_options="${extra_options} --git_branch \"${git_branch}\"" + fi + + if [[ $verbose == "true" ]]; then + extra_options="${extra_options} --verbose" + fi + + ${WALDO_CLI_BIN}/waldo upload "$build_path" --upload_token "$upload_token" ${extra_options} + env: + GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }} + WALDO_CLI_BIN: /usr/local/bin + WALDO_WRAPPER_NAME_OVERRIDE: 'Custom' + WALDO_WRAPPER_VERSION_OVERRIDE: '1.0.0' + shell: bash +branding: + icon: upload-cloud + color: blue