[eas-cli] feat(build:version:set): Allow for build version to be passed as arg so build:version:set can be used non-interactively
Why
Since build versions for iOS apps do not need to be incremented across release versions like Android apps, I like to reset the version back to 0 after releasing a new native version of my app. Currently, this must be done interactively and so cant easily be incorporated into an automated process like a Github Action. Allowing for the build version to be passed as an argument will allow for a simple step to be added to an action that can reset my build version as needed.
How
Added a new optional arg to the BuildVersionSetView and bypassed the current prompt if it is provided. If it is preferred to use a flag instead of an arg, I can make that change.
Test Plan
I used the cli with the argument to change my own apps build version.
Setting the version to 0
▲ $ easd build:version:set 0 -p ios -e preview
Resolved "development" environment for the build. Learn more: https://docs.expo.dev/eas/environment-variables/#setting-the-environment-for-your-builds
No environment variables with visibility "Plain text" and "Sensitive" found for the "development" environment on EAS.
Environment variables loaded from the "preview" build profile "env" configuration: [REDACTED]
Set buildNumber for project [REDACTED] with bundle identifier [REDACTED] to 0.
Confirming the version is updated with build:version:get
▲ $ easd build:version:get -p ios -e preview
The EAS build profile does not specify a Node.js version. Using the version specified in .nvmrc: 20
Resolved "development" environment for the build. Learn more: https://docs.expo.dev/eas/environment-variables/#setting-the-environment-for-your-builds
No environment variables with visibility "Plain text" and "Sensitive" found for the "development" environment on EAS.
Environment variables loaded from the "preview" build profile "env" configuration: [REDACTED]
iOS buildNumber - 0
Setting the version to 0 when it is already set to 0
▲ $ easd build:version:set 0 -p ios -e preview
Resolved "development" environment for the build. Learn more: https://docs.expo.dev/eas/environment-variables/#setting-the-environment-for-your-builds
No environment variables with visibility "Plain text" and "Sensitive" found for the "development" environment on EAS.
Environment variables loaded from the "preview" build profile "env" configuration: [REDACTED]
Version is already set to 0 for project [REDACTED] with bundle identifier [REDACTED].
Attempting to set the version with invalid input
▲ $ easd build:version:set foo -p ios -e preview
Resolved "development" environment for the build. Learn more: https://docs.expo.dev/eas/environment-variables/#setting-the-environment-for-your-builds
No environment variables with visibility "Plain text" and "Sensitive" found for the "development" environment on EAS.
Environment variables loaded from the "preview" build profile "env" configuration: [REDACTED]
Invalid value: buildNumber needs to consist only of up to 3 dot-separated positive integers
Subscribed to pull request
| File Patterns | Mentions |
|---|---|
| **/* | @szdziedzic, @khamilowicz, @sjchmiela, @radoslawkrzemien |
Generated by CodeMention
/changelog-entry new-feature Allow for build version to be passed as arg so command can be used non-interactively