https://github.com/getsidetrack/action-xcodeproj-spm-update
Update your Xcode project with the latest Swift Package dependencies
https://github.com/getsidetrack/action-xcodeproj-spm-update
dependabot dependencies swift swift-package-manager
Last synced: 5 months ago
JSON representation
Update your Xcode project with the latest Swift Package dependencies
- Host: GitHub
- URL: https://github.com/getsidetrack/action-xcodeproj-spm-update
- Owner: getsidetrack
- License: mit
- Created: 2022-02-15T16:05:01.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-25T10:08:17.000Z (almost 3 years ago)
- Last Synced: 2025-03-31T08:43:27.779Z (7 months ago)
- Topics: dependabot, dependencies, swift, swift-package-manager
- Language: Shell
- Homepage:
- Size: 11.7 KB
- Stars: 35
- Watchers: 1
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Xcode Project Swift Package Dependencies Update Action
This action will resolve the Swift Package Manager dependencies within your Xcode project. This can be useful in workflows that want to detect outdated dependencies, or wish to automatically create pull requests updating dependencies.
It will respect the boundaries you defined on your dependency, such as only updating to the next minor or on a given branch.
This action requires that you have checked out the source code of the project first, for example using [actions/checkout](https://github.com/actions/checkout).
```yaml
jobs:
dependencies:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: GetSidetrack/action-xcodeproj-spm-update@main
```By default, this action will fail if one or more of your dependencies are outdated. This can be suppressed by setting the input parameter of `failWhenOutdated` to false. Regardless of this setting, you may use the output parameter `dependenciesChanged` to run further steps (see example workflow at bottom).
```yaml
jobs:
dependencies:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: GetSidetrack/action-xcodeproj-spm-update@main
with:
failWhenOutdated: false
```Note that this action will change the `Package.resolved` file which should be checked in to your repository. However, this action will not itself commit or push changes to your repository. We recommend using a package such as [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) to achieve this automation.
By default this action is looking for an `.xcodeproj` file within the current directory (`.`). For projects where this is not true, you may provide a `directory` input parameter. This is helpful for monorepo projects which may contain multiple projects.
```yaml
jobs:
dependencies:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: GetSidetrack/action-xcodeproj-spm-update@main
with:
directory: 'iOS'
```Also, if your repository is using an `.xcworkspace` file then you can provide this through the `workspace` input. Note that you **must** also then specify the `scheme` input to be that of a shared scheme within your workspace.
```yaml
jobs:
dependencies:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: GetSidetrack/action-xcodeproj-spm-update@main
with:
workspace: 'Sidetrack.xcworkspace'
scheme: 'App-iOS'
```If the Package.resolved file has been built with an incompatible version of Xcode, or is in any way corrupted then `xcodebuild` is likely to fail. By setting `forceResolution` to true, it will force Xcode to resolve from nothing and can potentially avoid this problem.
You may specify the `xcodePath` input to a string specifying the path to the Xcode installation on your GitHub runner. This will most likely be one of the paths GitHub provides on their documentation [here](https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#xcode) but may also be your own path if using a self-hosted runner.
## Full Workflow
An example workflow is provided below which will create a pull request which any updated dependencies once a week. Feel free to use, or adapt this in your own workflows.
```yaml
name: Xcode Dependencieson:
schedule:
- cron: '0 6 * * 1' # Monday at 06:00 UTCpermissions:
contents: write
pull-requests: writejobs:
dependencies:
runs-on: macos-lateststeps:
- uses: actions/checkout@v2- name: Resolve Dependencies
id: resolution
uses: GetSidetrack/action-xcodeproj-spm-update@main
with:
forceResolution: true
failWhenOutdated: false- name: Create Pull Request
if: steps.resolution.outputs.dependenciesChanged == 'true'
uses: peter-evans/create-pull-request@v3
with:
branch: 'dependencies/ios'
delete-branch: true
commit-message: 'Update Xcode Dependencies'
title: 'Updated Xcode Dependencies'
```## Similar Packages
- [swift-package-dependencies-check](https://github.com/MarcoEidinger/swift-package-dependencies-check) is a GitHub Action which helps update dependencies for Swift Packages (as opposed to Xcode Projects with Swift Packages).