Skip to content

Add an action to upgrade all dependencies to the latest version, including new major version#10212

Open
ahoppen wants to merge 2 commits into
swiftlang:mainfrom
ahoppen:upgrade-dependencies-action
Open

Add an action to upgrade all dependencies to the latest version, including new major version#10212
ahoppen wants to merge 2 commits into
swiftlang:mainfrom
ahoppen:upgrade-dependencies-action

Conversation

@ahoppen

@ahoppen ahoppen commented Jun 17, 2026

Copy link
Copy Markdown
Member

I wanted to put this out here for some initial feedback. Let me know if this would require an evolution proposal.

Depends on swiftlang/swift-syntax#3366


When maintaining a non-library package, like a service executable, you may sometimes want to update all your dependencies to the latest version, including new major versions. This is particularly common when depending on packages that have a 0.x version. Without an explicit update of your dependency requirement, you may easily be stuck on an older version of the package and not pick up bug fixes that are, eg. included in 0.12.0 while you are still on 0.10.0.

Currently, this is a very manual process: For every package dependency, you need to eg. open the package in GitHub, check if the package has a new release and, if so, update the from: clause in the package manifest accordingly.

This adds a new swift package upgrade-dependencies action, which updates the package manifest to reference all the lastest versions. If these new versions introduce API breakages, it is expected to be the user’s responsibilities to update their package accordingly.

@bkhouri bkhouri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR @ahoppen. I am marking this a "request change" as I feel we can add additional automated tests to ensure the feature behaves as we expect in different use cases.

}

_ = try await execute(
["upgrade-dependencies"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion (blocking): Can we add additional automated tests that verify other scenarios? At a minimum, we should have a test that executes upgrade-dependencies:

  • where the directory tree does not contains a Package.swift. I believe this should fail with unknown package
  • where the Package.swift file is not readable to the current user. I believe this should fail with cannot find package manifest in <path-to-Package.swift>
  • where 0 package depedencies have newer versions. We expect the Package.swift to be unchanged.
  • where 2 packages dependencies have newer versions
  • where 3+ (multiple) packages dependencies have newer versions
  • where Package.swift contains package dependencies that use a package registry. Executes the same number of tests where we validate a package dependency on a git URL.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the tests and also added support for resolving the latest version from a package registry. Thanks for that suggestion, I forgot about that.

  • where 3+ (multiple) packages dependencies have newer versions

I skipped this because I don’t think there’s any significant difference between 2 and 3 updated package dependencies.

@bkhouri bkhouri added pending evolution proposal dependencies Changes to dependencies and relevant checks swift package `swift package` subcommand labels Jun 25, 2026
ahoppen added 2 commits July 2, 2026 13:26
…uding new major version

When maintaining a non-library package, like a service executable, you may sometimes want to update all your dependencies to the latest version, including new major versions. This is particularly common when depending on packages that have a `0.x` version. Without an explicit update of your dependency requirement, you may easily be stuck on an older version of the package and not pick up bug fixes that are, eg. included in `0.12.0` while you are still on `0.10.0`.

Currently, this is a very manual process: For every package dependency, you need to eg. open the package in GitHub, check if the package has a new release and, if so, update the `from:` clause in the package manifest accordingly.

This adds a new `swift package upgrade-dependencies` action, which updates the package manifest to reference all the lastest versions. If these new versions introduce API breakages, it is expected to be the user’s responsibilities to update their package accordingly.
@ahoppen ahoppen force-pushed the upgrade-dependencies-action branch from 8ab92f5 to eac28da Compare July 2, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Changes to dependencies and relevant checks pending evolution proposal swift package `swift package` subcommand

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants