Skip to content

feat: add asc builds next-number command #13

@hanrw

Description

@hanrw

Summary

Add a builds next-number command that returns the next available build number for a given app/version/platform combination. This eliminates manual lookup when uploading builds.

Motivation

After uploading builds, the build number must be unique per version/platform. Currently users must:

  1. Run asc builds list --app-id <id> --version <ver> --platform <plat>
  2. Manually find the highest build number from JSON output
  3. Increment it

This is error-prone and not automation-friendly.

Proposed Command

asc builds next-number --app-id <id> --version <version> --platform <platform>

All three flags are required — you need to know exactly which version/platform you're targeting.

Use Cases

CI/CD Pipeline Automation

NEXT_BUILD=$(asc builds next-number --app-id $APP_ID --version 1.0.1 --platform ios)
asc builds archive --scheme MyApp --upload \
  --app-id $APP_ID --version 1.0.1 --build-number $NEXT_BUILD

Local Dev Before Upload

asc builds next-number --app-id 6748760927 --version 1.0.1 --platform ios
# → 4

Multi-Platform Apps

asc builds next-number --app-id $ID --version 2.0 --platform ios     # → 12
asc builds next-number --app-id $ID --version 2.0 --platform macos   # → 5

Expected Behavior

  • Queries existing builds via listBuilds(appId:platform:version:)
  • Finds max buildNumber (parsed as integer)
  • Returns max + 1
  • If no builds exist for the version, returns 1
  • Default output: plain number (for scripting)
  • --output json output includes affordance: "uploadBuild": "asc builds upload --app-id ... --version ... --build-number <next>"

Example Output

Given builds with numbers 1, 2, 3 for version 1.0.1/iOS:

$ asc builds next-number --app-id 6748760927 --version 1.0.1 --platform ios
4

$ asc builds next-number --app-id 6748760927 --version 1.0.1 --platform ios --output json --pretty
{
  "data" : {
    "affordances" : {
      "uploadBuild" : "asc builds upload --app-id 6748760927 --file <path> --version 1.0.1 --build-number 4 --platform ios"
    },
    "appId" : "6748760927",
    "nextBuildNumber" : 4,
    "platform" : "IOS",
    "version" : "1.0.1"
  }
}

Edge Cases

  • Non-numeric build numbers: warn and skip when computing max
  • No existing builds: return 1
  • All builds expired or failed: still count them (build numbers are consumed regardless)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions