Skip to content

Commit

Permalink
Add Github Actions to publish to Cocoapods and npm (#169)
Browse files Browse the repository at this point in the history
Fixes #166.

This is preparatory work to publish to the averred package managers.

Still to happen for first release:

- Add an `NPM_TOKEN` to npm.
- Tag the release as `0.28.3-0`
- Perform the release.

After the first release, we still need to:

- verify releases happen
- update the podspec template 
- update the documentation about pre-releases.

Subsequent releases, we should think about automating:

- update the `package.json` and ``Cargo.toml` version numbers.
- rotate the `CHANGELOG.md` (currently we don't have a change log).
- tag the release
- do the release
  • Loading branch information
jhugman authored Dec 3, 2024
1 parent 189decf commit 9bba545
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 3 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/cocoapods.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish to CocoaPods

on:
release:
types: [published]
workflow_dispatch:

jobs:
publish-cocoapods:
runs-on: macos-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"

- name: Install CocoaPods
run: gem install cocoapods

- name: Lint Podspec
run: pod spec lint uniffi-bindgen-react-native.podspec

- name: Publish to CocoaPods
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: pod trunk push uniffi-bindgen-react-native.podspec
22 changes: 22 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Publish to npmjs
on:
release:
types: [published]
workflow_dispatch:

jobs:
publish-npmjs:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- run: npm install
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 7 additions & 3 deletions uniffi-bindgen-react-native.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ Pod::Spec.new do |s|
s.license = { :type => package['license'], :file => 'LICENSE' }
s.author = { package['author']['name'] => package['author']['email'] }
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
s.platform = :ios, '9.0'
s.source_files = 'cpp/includes/*.{h,cpp,hpp}'
s.dependency 'React'
s.platform = :ios, '13.0'
s.source_files = 'cpp/includes/*.{h,cpp,hpp}'
s.swift_versions = '4.0'
s.pod_target_xcconfig = {
'SWIFT_OPTIMIZATION_LEVEL' => '-Onone',
}
s.dependency 'React-Core'
end

0 comments on commit 9bba545

Please sign in to comment.