Skip to content

Commit 651bd02

Browse files
committed
Init
0 parents  commit 651bd02

File tree

4 files changed

+249
-0
lines changed

4 files changed

+249
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Publish Swift Bindings
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'nostr-sdk repo release (MAJOR.MINOR.PATCH)'
7+
required: true
8+
type: string
9+
10+
jobs:
11+
build-tag-release:
12+
name: Build, tag, and release the Nostr SDK Swift bindings
13+
runs-on: macOS-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- name: Checkout nostr repo
18+
uses: actions/checkout@v3
19+
with:
20+
repository: ${{ github.repository_owner }}/nostr
21+
path: build
22+
ref: nostr-sdk-ffi-v${{ inputs.version }}
23+
24+
- name: Checkout nostr-sdk-swift repo
25+
uses: actions/checkout@v3
26+
with:
27+
path: dist
28+
ssh-key: ${{ secrets.SWIFT_DEPLOY_SSH_KEY }}
29+
30+
- name: Build Swift bindings
31+
working-directory: build/bindings/nostr-sdk-ffi
32+
run: |
33+
make init
34+
make bindings-swift
35+
36+
- name: Compress XCFramework
37+
working-directory: build/bindings/nostr-sdk-ffi/bindings-swift
38+
run: |
39+
zip -9 -r nostr_sdkFFI.xcframework.zip nostr_sdkFFI.xcframework
40+
echo "XCF_CHECKSUM=`swift package compute-checksum nostr_sdkFFI.xcframework.zip`" >> $GITHUB_ENV
41+
42+
- name: Update Swift Package definition
43+
working-directory: build/bindings/nostr-sdk-ffi/bindings-swift
44+
run: |
45+
sed 's#.binaryTarget(name: "nostr_sdkFFI", path: "./nostr_sdkFFI.xcframework"),#.binaryTarget(name: "nostr_sdkFFI", url: "https://github.com/rust-nostr/nostr-sdk-swift/releases/download/${{ inputs.version }}/nostr_sdkFFI.xcframework.zip", checksum: "${{ env.XCF_CHECKSUM }}"),#;/.testTarget(name: "NostrSDKTests", dependencies: \["NostrSDK"\]),/d' Package.swift > ../../../../dist/Package.swift
46+
cp -r Sources ../../../../dist
47+
48+
- name: Tag the Swift bindings
49+
working-directory: dist
50+
run: |
51+
git config user.name github-actions
52+
git config user.email [email protected]
53+
git add Package.swift
54+
git add Sources
55+
git commit -m "Update Nostr SDK Swift bindings to version ${{ inputs.version }}"
56+
git push
57+
git tag ${{ inputs.version }} -m "${{ inputs.version }}"
58+
git push --tags
59+
60+
- name: Release and attach XCFramework binary artifact
61+
uses: ncipollo/release-action@v1
62+
with:
63+
artifacts: "build/bindings/nostr-sdk-ffi/bindings-swift/nostr_sdkFFI.xcframework.zip"
64+
tag: ${{ inputs.version }}
65+
token: ${{ secrets.GITHUB_TOKEN }}
66+
name: ${{ inputs.version }}
67+
prerelease: true

.gitignore

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/macos,swift
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,swift
3+
4+
### macOS ###
5+
# General
6+
.DS_Store
7+
.AppleDouble
8+
.LSOverride
9+
10+
# Icon must end with two \r
11+
Icon
12+
13+
14+
# Thumbnails
15+
._*
16+
17+
# Files that might appear in the root of a volume
18+
.DocumentRevisions-V100
19+
.fseventsd
20+
.Spotlight-V100
21+
.TemporaryItems
22+
.Trashes
23+
.VolumeIcon.icns
24+
.com.apple.timemachine.donotpresent
25+
26+
# Directories potentially created on remote AFP share
27+
.AppleDB
28+
.AppleDesktop
29+
Network Trash Folder
30+
Temporary Items
31+
.apdisk
32+
33+
### macOS Patch ###
34+
# iCloud generated files
35+
*.icloud
36+
37+
### Swift ###
38+
# Xcode
39+
#
40+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
41+
42+
## User settings
43+
xcuserdata/
44+
45+
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
46+
*.xcscmblueprint
47+
*.xccheckout
48+
49+
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
50+
build/
51+
DerivedData/
52+
*.moved-aside
53+
*.pbxuser
54+
!default.pbxuser
55+
*.mode1v3
56+
!default.mode1v3
57+
*.mode2v3
58+
!default.mode2v3
59+
*.perspectivev3
60+
!default.perspectivev3
61+
62+
## Obj-C/Swift specific
63+
*.hmap
64+
65+
## App packaging
66+
*.ipa
67+
*.dSYM.zip
68+
*.dSYM
69+
70+
## Playgrounds
71+
timeline.xctimeline
72+
playground.xcworkspace
73+
74+
# Swift Package Manager
75+
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
76+
# Packages/
77+
# Package.pins
78+
# Package.resolved
79+
# *.xcodeproj
80+
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
81+
# hence it is not needed unless you have added a package configuration file to your project
82+
# .swiftpm
83+
84+
.build/
85+
86+
# CocoaPods
87+
# We recommend against adding the Pods directory to your .gitignore. However
88+
# you should judge for yourself, the pros and cons are mentioned at:
89+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
90+
# Pods/
91+
# Add this line if you want to avoid checking in source code from the Xcode workspace
92+
# *.xcworkspace
93+
94+
# Carthage
95+
# Add this line if you want to avoid checking in source code from Carthage dependencies.
96+
# Carthage/Checkouts
97+
98+
Carthage/Build/
99+
100+
# Accio dependency management
101+
Dependencies/
102+
.accio/
103+
104+
# fastlane
105+
# It is recommended to not store the screenshots in the git repo.
106+
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
107+
# For more information about the recommended setup visit:
108+
# https://docs.fastlane.tools/best-practices/source-control/#source-control
109+
110+
fastlane/report.xml
111+
fastlane/Preview.html
112+
fastlane/screenshots/**/*.png
113+
fastlane/test_output
114+
115+
# Code Injection
116+
# After new code Injection tools there's a generated folder /iOSInjectionProject
117+
# https://github.com/johnno1962/injectionforxcode
118+
119+
iOSInjectionProject/
120+
121+
# End of https://www.toptal.com/developers/gitignore/api/macos,swift

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022-2023 Yuki Kishimoto
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Nostr SDK – Swift Package
2+
3+
## Installation
4+
5+
This package is intended to be used with the [Swift Package Manager](https://www.swift.org/package-manager/).
6+
7+
### Xcode
8+
9+
Via `File > Add Packages...`, add
10+
11+
```
12+
https://github.com/rust-nostr/nostr-sdk-swift.git
13+
```
14+
15+
as a package dependency in Xcode.
16+
17+
### Swift Package
18+
19+
Add the following to the dependencies array in your `Package.swift`:
20+
21+
``` swift
22+
.package(url: "https://github.com/rust-nostr/nostr-sdk-swift.git", from: "0.0.1"),
23+
```
24+
25+
## 📄 Usage
26+
27+
``` swift
28+
import NostrSDK
29+
30+
// TODO
31+
32+
```
33+
34+
## Information for Maintainers and Contributors
35+
36+
This repository is used to publish a Swift package providing Swift bindings to the Nostr SDK's [underlying Rust implementation](https://github.com/rust-nostr/nostr). The Swift bindings are generated using [UniFFi](https://github.com/mozilla/uniffi-rs).
37+
38+
Any changes to the Nostr SDK, the Swift bindings, and the configuration of this Swift package must be made via the [nostr-sdk](https://github.com/rust-nostr/nostr) repo.
39+
40+
To release a new version of this package, go to the Actions tab of this GitHub repository. Then select the *Publish Swift Package* workflow and run it on the `master` branch. It will ask for a version as input. This allows you to specify the version (e.g., *0.0.1*) of the [nostr-sdk](https://github.com/rust-nostr/nostr) repository that should be released as a Swift package.

0 commit comments

Comments
 (0)