Skip to content

feat: swift package release workflow#395

Merged
NathanWalker merged 2 commits into
mainfrom
feat/swift-package-release
Jun 25, 2026
Merged

feat: swift package release workflow#395
NathanWalker merged 2 commits into
mainfrom
feat/swift-package-release

Conversation

@NathanWalker

@NathanWalker NathanWalker commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Build and release pipeline for NativeScript.xcframework runtime binary to no longer be bundled inside the npm packages. Instead, they are published as GitHub Release assets and referenced via Swift Package Manager (SPM) in the Xcode project templates. The npm packages now only contain the Xcode project template and the metadata generator. The workflow is restructured to support this new distribution model, with improved artifact handling and SPM manifest stamping.

Required to merge first before this: NativeScript/ios-spm#2

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Package templates now resolve SwiftPM binary artifacts (remote Swift package products) instead of embedding prebuilt xcframeworks.
    • Expanded release pipeline to build, checksum, publish, and stamp artifacts for both iOS and visionOS.
    • Added automation to stamp SwiftPM manifest/package and template runtime versions during packaging.
  • Bug Fixes

    • Improved artifact consistency with per-target versioning, checksum generation, and a SwiftPM resolution smoke test.
  • Chores

    • Refreshed build/release workflow structure to support updated version/tag handling and per-target publishing.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 942680ad-9c67-444f-92b9-18f1b757576e

📥 Commits

Reviewing files that changed from the base of the PR and between 3e00ac8 and 06724b3.

📒 Files selected for processing (2)
  • .github/workflows/npm_release.yml
  • scripts/stamp-spm-release.mjs
🚧 Files skipped from review as they are similar to previous changes (2)
  • scripts/stamp-spm-release.mjs
  • .github/workflows/npm_release.yml

📝 Walkthrough

Walkthrough

The release and packaging flow now computes shared version values, builds iOS and visionOS artifacts, stamps packaged templates, switches project templates to SwiftPM-delivered frameworks, publishes release assets, and updates and verifies the ios-spm manifest.

Changes

SwiftPM release packaging

Layer / File(s) Summary
SwiftPM project templates
project-template-ios/..., project-template-vision/...
iOS and visionOS templates remove embedded xcframework references, add remote Swift package dependencies, and update linker flags for SwiftPM-provided frameworks.
npm template stamping
build_npm_ios.sh, build_npm_vision.sh, scripts/stamp-template-version.mjs
The npm packaging scripts stamp the packaged template project with the version from package.json and stop copying bundled xcframeworks into the npm output.
SPM artifact packaging
build_spm_artifacts.sh, build_all_ios.sh, build_all_vision.sh
The build helper zips the NativeScript and TKLiveSync xcframeworks, computes checksums, writes per-target checksum env files, and is invoked from the all-iOS and all-vision build scripts.
Release manifest stamping
scripts/stamp-spm-release.mjs
The stamping CLI updates ios-spm/Package.swift with a release version and checksum values from env files, then checks for remaining placeholder tokens.
Version setup, publishing, and verification
.github/workflows/npm_release.yml
The release workflow computes shared npm version and tag values, builds iOS and visionOS artifacts, publishes GitHub release assets, updates the ios-spm manifest and tag, publishes npm packages, and verifies SwiftPM resolution.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

I hopped through builds with SwiftPM cheer,
Two release trails now run quite clear.
I zipped the checksums, stamped the part,
And tucked new versions in with art.
Hoppy deploy! 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the new Swift package release workflow.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread .github/workflows/npm_release.yml Fixed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (1)
.github/workflows/npm_release.yml (1)

371-413: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Extend the SPM smoke test to cover visionOS artifacts too.

The release publishes visionOS zips/checksums, but this probe only resolves the iOS product. A bad visionOS checksum or missing asset would still pass the workflow.

Before wiring this in, verify the visionOS product/target names in ios-spm/Package.swift; then add a second probe target/platform that forces SwiftPM to resolve the visionOS binary targets.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/npm_release.yml around lines 371 - 413, The SPM smoke test
only exercises the iOS binary resolution, so a broken visionOS artifact could
still slip through. Update the verify-spm job to also resolve the visionOS
package by adding a second probe target/platform in the Generate a probe package
step, and make sure the visionOS product/target names match those declared in
ios-spm/Package.swift so SwiftPM is forced to fetch and checksum-validate the
visionOS zips as well.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/npm_release.yml:
- Around line 20-31: Pin the workflow’s GITHUB_TOKEN permissions for the
remaining jobs so they only have repository read access, since `setup`,
`spm-update`, and `verify-spm` currently inherit broader defaults. Update the
job definitions in `npm_release.yml` to set minimal read-only permissions while
keeping the cross-repo write path on `IOS_SPM_TOKEN`, and apply the same
restriction consistently to the other affected jobs in the workflow.
- Around line 273-278: The ios-spm checkout in the workflow is persisting the
cross-repo write token in git config, which should be avoided. Update the
checkout step using actions/checkout for ios-spm to set persist-credentials to
false, then ensure IOS_SPM_TOKEN is only provided to the step that performs the
git push during the stamping flow. Apply the same change to the other ios-spm
stamping checkout/push sequence referenced in the workflow.
- Around line 43-47: The release version selection in the npm release workflow
is currently taking the version from package.json even on tag-triggered runs, so
the publish stamp can diverge from the Git tag. Update the version resolution
logic in the workflow step that sets NPM_VERSION to detect tag builds from
GITHUB_REF, extract the tag version, and compare it against package.json before
publishing; if they differ, fail the job instead of continuing. Keep the
existing prerelease path that uses scripts/get-next-version.js for non-tag
builds, and make sure the guard lives near the NPM_VERSION assignment in the
release job.
- Around line 312-329: The publish job can run before the SwiftPM
assets/manifest workflow has finished, so gate it on the jobs that produce those
release artifacts. Update the publish job in npm_release.yml to wait for the
github-release and spm-update jobs as well as setup/build/test, using the
publish job’s dependency list so npm publishing only starts after the SPM
templates, runtime artifacts, and ios-spm tag are available.

In `@build_npm_ios.sh`:
- Around line 18-21: The template copy/stamp flow is targeting the wrong project
path because the current copy step leaves project-template-ios nested under the
framework output, while the stamp step in build_npm_ios.sh expects
__PROJECT_NAME__.xcodeproj/project.pbxproj at the framework root. Fix this by
either flattening the copy so the Xcode project lands directly under
$OUTPUT_DIR/framework or by updating the stamp-template-version.mjs invocation
to point at the actual nested project path; keep the NPM_VERSION and stamp
command aligned with the final copied location.

In `@build_npm_vision.sh`:
- Around line 18-21: The template copy step is placing the vision project under
the wrong directory, so the stamping path in build_npm_vision.sh no longer
matches the generated framework tree. Update the copy logic that creates the
framework output so the contents of project-template-vision are copied directly
into the framework directory, and then verify the stamp-template-version.mjs
target still resolves to __PROJECT_NAME__.xcodeproj/project.pbxproj within that
same framework tree.

In `@scripts/stamp-spm-release.mjs`:
- Around line 53-56: The checksum parsing in stamp-spm-release.mjs accepts
values without validation, so empty or malformed checksums can be stamped into
Package.swift and slip past strict mode. Update the checksum handling around the
parsing logic and the stamping flow (including the later stamping block) to
validate each checksum value before storing or substituting it, and reject or
fail fast on missing/invalid checksum formats using the existing checksum
map/lookup path.

---

Nitpick comments:
In @.github/workflows/npm_release.yml:
- Around line 371-413: The SPM smoke test only exercises the iOS binary
resolution, so a broken visionOS artifact could still slip through. Update the
verify-spm job to also resolve the visionOS package by adding a second probe
target/platform in the Generate a probe package step, and make sure the visionOS
product/target names match those declared in ios-spm/Package.swift so SwiftPM is
forced to fetch and checksum-validate the visionOS zips as well.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 36daa942-ade4-46ee-ac3a-afa96dc51df3

📥 Commits

Reviewing files that changed from the base of the PR and between 6778dfd and 3e00ac8.

📒 Files selected for processing (12)
  • .github/workflows/npm_release.yml
  • build_all_ios.sh
  • build_all_vision.sh
  • build_npm_ios.sh
  • build_npm_vision.sh
  • build_spm_artifacts.sh
  • project-template-ios/__PROJECT_NAME__.xcodeproj/project.pbxproj
  • project-template-ios/internal/nativescript-build.xcconfig
  • project-template-vision/__PROJECT_NAME__.xcodeproj/project.pbxproj
  • project-template-vision/internal/nativescript-build.xcconfig
  • scripts/stamp-spm-release.mjs
  • scripts/stamp-template-version.mjs

Comment thread .github/workflows/npm_release.yml
Comment thread .github/workflows/npm_release.yml Outdated
Comment thread .github/workflows/npm_release.yml
Comment thread .github/workflows/npm_release.yml
Comment thread build_npm_ios.sh
Comment thread build_npm_vision.sh
Comment thread scripts/stamp-spm-release.mjs
@NathanWalker NathanWalker merged commit 732c439 into main Jun 25, 2026
9 checks passed
@NathanWalker NathanWalker deleted the feat/swift-package-release branch June 25, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants