diff --git a/ci/bump-no-log.sh b/ci/bump-no-log.sh deleted file mode 100755 index e265cffd..00000000 --- a/ci/bump-no-log.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -if [ ! -z $1 ]; then - BUILD="build:$1" -fi -bundle exec fastlane bump $BUILD only:true diff --git a/ci/bump-since.sh b/ci/bump-since.sh deleted file mode 100755 index a5709b2c..00000000 --- a/ci/bump-since.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -if [ ! -z $1 ]; then - SINCE="since:$1" -fi -bundle exec fastlane bump $SINCE diff --git a/ci/bump-version.sh b/ci/bump-version.sh deleted file mode 100755 index d865d393..00000000 --- a/ci/bump-version.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -if [ -z $1 ]; then - echo "Version number required" - exit 1 -fi -if [ ! -z $2 ]; then - BUILD="build:$2" -fi -VERSION="version:$1" -bundle exec fastlane bump $VERSION $BUILD diff --git a/ci/bump.sh b/ci/bump.sh index 3370f7f8..c7fd4da9 100755 --- a/ci/bump.sh +++ b/ci/bump.sh @@ -1,5 +1,67 @@ -#!/bin/sh -if [ ! -z $1 ]; then - BUILD="build:$1" +#!/bin/bash +# https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash + +POSITIONAL_ARGS=() + +while [[ $# -gt 0 ]]; do + case $1 in + -v) + OPT_VERSION="version:$2" + shift # past argument + shift # past value + ;; + -b) + OPT_BUILD="build:$2" + shift # past argument + shift # past value + ;; + -s) + OPT_SINCE="since:$2" + shift # past argument + shift # past value + ;; + -na) + OPT_NO_API=1 + shift # past argument + ;; + -nl) + OPT_NO_LOG="no_log:true" + shift # past argument + ;; + -d) + OPT_DRY_RUN=1 + shift # past argument + ;; + -*|--*) + echo "Unknown option $1" + exit 1 + ;; + *) + POSITIONAL_ARGS+=("$1") # save positional arg + shift # past argument + ;; + esac +done + +set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters + +CMD_API=$(dirname "$0")/update-bundled-api.sh +CMD_FASTLANE="bundle exec fastlane bump $OPT_VERSION $OPT_BUILD $OPT_SINCE $OPT_NO_LOG" + +if [[ -n $OPT_DRY_RUN ]]; then + echo "VERSION = $OPT_VERSION" + echo "BUILD = $OPT_BUILD" + echo "SINCE = $OPT_SINCE" + echo "NO_API = $OPT_NO_API" + echo "NO_LOG = $OPT_NO_LOG" + if [[ -z $OPT_NO_API ]]; then + echo "$CMD_API" + fi + echo "$CMD_FASTLANE" + exit 0 fi -bundle exec fastlane bump $BUILD + +if [[ -z $OPT_NO_API ]]; then + eval "$CMD_API" +fi +eval "$CMD_FASTLANE" diff --git a/ci/update-bundled-api.sh b/ci/update-bundled-api.sh index 827eca96..3f540607 100755 --- a/ci/update-bundled-api.sh +++ b/ci/update-bundled-api.sh @@ -1,5 +1,5 @@ #!/bin/bash -DESTINATION="Passepartout/Library/Sources/APILibrary/API" +DESTINATION="Passepartout/Library/Sources/CommonAPI/API" API_VERSION="v5" mkdir tmp diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 39e07f37..35e4e955 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -18,13 +18,14 @@ fastlane_require "fileutils" Dotenv.load ".env.secret" setup_ci if ENV["CI"] +api = "Passepartout/Library/Sources/CommonAPI/API" logname = "CHANGELOG.txt" build_path = "build" derived_data_path = "build/derived_data" desc "Bump version" lane :bump do |options| - unless options[:only] + unless options[:no_log] if options[:since] between = [options[:since], "HEAD"] else @@ -55,7 +56,7 @@ lane :bump do |options| end commit_version_bump( message: "Bump version", - include: [logname] + include: [api, logname] ) add_git_tag( includes_lane: false,