How to set Jenkins environment variable from script How to set Jenkins environment variable from script xcode xcode

How to set Jenkins environment variable from script


Add a build step to execute shell - in there determine APP_BUILD_NUMBER and output to file, e.g.

APP_BUILD_NUMBER=$(curl --request GET 'https://api.domain.com/api/GetBuildNumber')APP_BUILD_NUMBER=$((APP_BUILD_NUMBER +1))echo APP_BUILD_NUMBER=$APP_BUILD_NUMBER > build.properties

then add build step Inject environment variables and set there Properties File Path to $WORKSPACE/build.properties

after that $APP_BUILD_NUMBER is accessible in all build steps after as environment variable; e.g. in Xcode build step