Skip to content

Instantly share code, notes, and snippets.

@afarnham
Last active June 10, 2025 20:59
Show Gist options
  • Save afarnham/7e6a6946ea5139a182678a6c7e84065a to your computer and use it in GitHub Desktop.
Save afarnham/7e6a6946ea5139a182678a6c7e84065a to your computer and use it in GitHub Desktop.

This guide will help you create new releases on GitHub for your Swift Packages that host binary executable assets. This is a multistep process that consists of:

  • Staging a draft release on Github
  • Uploading your binary artifacts to the draft release
  • Updating the Package.swift to point to the uploaded assets in a staging branch
  • Finalizing the Github release

Setup

  • Install the GitHub CLI
  • brew install gh
  • Install jq
  • brew install jq

Step 1: Create a GitHub Draft Release

  • Navigate to your repository on GitHub.com

  • Click on the Releases on your main GitHub page for your repo.

  • Click Draft a new release

  • Add a tag for your release (e.g. 1.0.0) and remember this value

  • Ensure the target is your primary branch (e.g. main or develop, etc…)

  • Drag each of your binary artifacts to the box that says Attach binaries by dropping them here or selecting them

  • Click Save DraftDO NOT PUBLISH THIS RELEASE YET

Step 3: Updating Package.swift

  • Navigate to your cloned copy of the repository on your computer via the Terminal.
  • Create and checkout a new branch for the Package.swift updates
  • Run the following command, replacing <release tag> with tag value created in the previous step.

gh release view <release tag> --json assets | \

jq '.assets[] | { name: .name, url: (.apiUrl + ".zip") }'

Here is an example of the above command with actual output:
gh release view 1.1.2 --json assets | \

jq '.assets[] | { name: .name, url: (.apiUrl + ".zip") }'

{

"name": "MyBinaryLibrary.1.1.2.xcframework.zip",

"url": "https://api.github.com/repos/your_org/your-lib/releases/assets/93024549.zip"

}

{

"name": "MyBinaryLibrary.1.1.2.xcframework.zip",

"url": "https://api.github.com/repos/your_org/your-lib/releases/assets/93028050.zip"

}

  • Update each binary target in your Package.swift with the url values in the output above.
  • Ensure you update the checksum in Package.swift, if needed, using the value produced with this command:
  • swift package compute-checksum MyBinaryLibrary.1.1.2.xcframework.zip
  • To test that your Package.swift is valid, open the package in Xcode and it should successfully resolve the package with the new binary files.
  • Commit and push your changes
  • Create a pull request and follow standard review policies for your package
  • Merge the pull request

Step 4: Finalize the release

  • Return to your draft release
  • Ensure the tag is set to the value you expect and the target branch is pointing to your main branch
  • Press the Publish Release button.
@ecito
Copy link

ecito commented Jun 10, 2025

I love you <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment