diff --git a/.github/workflows/publish_pod.yml b/.github/workflows/publish_pod.yml new file mode 100644 index 0000000..2e2e949 --- /dev/null +++ b/.github/workflows/publish_pod.yml @@ -0,0 +1,38 @@ +name: Publish Capacitor Plugin to CocoaPods Trunk + +on: + workflow_call: + secrets: + COCOAPODS_TRUNK_TOKEN: + required: true + CAP_GH_RELEASE_TOKEN: + required: true + workflow_dispatch: + +jobs: + publish-ios: + runs-on: macos-15 + if: github.ref == 'refs/heads/main' + timeout-minutes: 30 + steps: + - run: sudo xcode-select --switch /Applications/Xcode_26.2.app + - run: xcrun simctl list > /dev/null + - run: xcodebuild -downloadPlatform iOS + - uses: actions/setup-node@v6 + with: + node-version: 24 + - uses: actions/checkout@v5 + with: + fetch-depth: 0 + ref: ${{ github.ref_name }} # explicitly set ref to include commit from `semantic-release` + token: ${{ secrets.CAP_GH_RELEASE_TOKEN }} + - name: Install Cocoapods + run: | + gem install cocoapods + - name: Deploy to Cocoapods + run: | + set -eo pipefail + npm run publish:cocoapod + env: + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} + working-directory: ./packages/capacitor-plugin diff --git a/.github/workflows/release_plugin.yml b/.github/workflows/release_plugin.yml index 6a4ff28..73815f4 100644 --- a/.github/workflows/release_plugin.yml +++ b/.github/workflows/release_plugin.yml @@ -47,4 +47,12 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }} GH_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }} - run: npx semantic-release \ No newline at end of file + run: npx semantic-release + + publish-pod: + needs: release + uses: ./.github/workflows/publish_pod.yml + secrets: + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} + CAP_GH_RELEASE_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }} + diff --git a/packages/capacitor-plugin/package.json b/packages/capacitor-plugin/package.json index 12a5e9f..00159a4 100644 --- a/packages/capacitor-plugin/package.json +++ b/packages/capacitor-plugin/package.json @@ -43,7 +43,8 @@ "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs", "clean": "rimraf ./dist", "watch": "tsc --watch", - "prepublishOnly": "npm run build" + "prepublishOnly": "npm run build", + "publish:cocoapod": "pod trunk push ./CapacitorGeolocation.podspec --allow-warnings" }, "dependencies": { "@capacitor/synapse": "^1.0.4"