Skip to content

A collection of Swift Package-related shell scripts.

License

danielsaidi/SwiftPackageScripts

Repository files navigation

Project Icon

Version Swift 6.0 Documentation MIT License Sponsor my work

Swift Package Scripts

Swift Package Scripts has Terminal scripts that can build and test your Swift Package, build DocC documentation and deploy it to GitHub Pages, generate XCFramework zip files, and create new semantic versions.

Scripts

The scripts folder contains the following scripts:

  • build.sh - Build a target for all or some platforms.
  • chmod.sh - Runs chmod +x on all scripts in the script folder.
  • docc.sh - Build DocC documentation for all or some platforms.
  • framework.sh - Build an XCFramework for all or some platforms.
  • git_default_branch.sh - Get the default git branch name.
  • package_name.sh - Get the name of the main Swift package.
  • release.sh - Make a release build with several validation steps.
  • sync_from.sh - Sync scripts from a Swift Package Scripts folder.
  • test.sh - Test a target on all or some platforms.
  • validate_git_branch.sh - Validate the current branch.
  • validate_release.sh - Validate the package for release.
  • version_bump.sh - Bump the current version number and create a new tag.
  • version_number.sh - Get the current version number from the latest tag.

Note that you have to run chmod +x <SCRIPT> to be able to run a script for the first time. You can use chmod.sh to do this for all scripts.

GitHub Actions

The .github folder contains the following GitHub Actions workflows:

  • build.yml - Build the package for all or some platforms.
  • docc.yml - Build DocC documentation and deploy it to GitHub Pages.
  • test.yml - Test the package on all or some platforms.

These workflows use main as git branch. Change this in each file to trigger the workflows for other branches. As the files are not part of the sync, you have to copy them manually.

Installation

Swift Package Scripts can be installed to your computer by cloning the repository:

git clone https://github.com/danielsaidi/SwiftPackageScripts.git

You can then navigate to the folder and sync the scripts to any older folder, using the scripts/sync_to.sh script.

./sync_to.sh ../AnotherProjectFolder

This will remove any already existing folder, and replace it with the latest version. After the first sync, you can use scripts/sync_from.sh in the project folder to sync from another folder.

Support My Work

You can become a sponsor to help me dedicate more time on my various open-source tools. Every contribution, no matter the size, makes a real difference in keeping these tools free and actively developed.

Sample Package

This repository has a sample package that is used to test that everything works as expected.

Documentation

For more information about these scripts, and how to set up project-specific scripts, see the online here.

Contact

Feel free to reach out if you have questions or if you want to contribute in any way:

License

Swift Package Scripts is available under the MIT license. See the LICENSE file for more info.

About

A collection of Swift Package-related shell scripts.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project