Skip to content

Commit ca7a245

Browse files
chore: automate Capacitor release versions (#43)
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 08e464c commit ca7a245

1 file changed

Lines changed: 27 additions & 7 deletions

File tree

.github/workflows/create-release-pr.yml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ on:
3030
workflow_dispatch:
3131
inputs:
3232
capacitor_version:
33-
description: 'New Capacitor plugin version (e.g., 1.1.0 or 1.1.0-beta.1)'
34-
required: true
33+
description: 'Override the auto-detected version (e.g., 1.1.0 or 1.1.0-beta.1). Leave blank to auto-detect.'
34+
required: false
3535
type: string
3636
android_version:
3737
description: 'New Android SDK Version (e.g., 5.7.6). Leave blank to skip.'
@@ -48,19 +48,37 @@ on:
4848
default: main
4949

5050
jobs:
51+
determine_version:
52+
runs-on: ubuntu-latest
53+
outputs:
54+
capacitor_version: ${{ inputs.capacitor_version || steps.next_version.outputs.version }}
55+
release_needed: ${{ inputs.capacitor_version != '' || steps.next_version.outputs.release-needed == 'true' }}
56+
57+
steps:
58+
- name: Determine Capacitor plugin version
59+
if: github.event_name == 'workflow_dispatch' && inputs.capacitor_version == ''
60+
id: next_version
61+
uses: OneSignal/sdk-shared/.github/actions/determine-next-version@main
62+
with:
63+
github-token: ${{ secrets.GH_PUSH_TOKEN || github.token }}
64+
target-repo: OneSignal/OneSignal-Capacitor-SDK
65+
target-branch: ${{ inputs.target_branch }}
66+
5167
prep:
68+
needs: determine_version
69+
if: needs.determine_version.outputs.release_needed == 'true'
5270
uses: OneSignal/sdk-shared/.github/workflows/prep-release.yml@main
5371
secrets:
5472
# Need this cross-repo token (sdk-shared & this repo) to perform changes
5573

5674
GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
5775
with:
5876
target_repo: OneSignal/OneSignal-Capacitor-SDK
59-
version: ${{ inputs.capacitor_version }}
77+
version: ${{ needs.determine_version.outputs.capacitor_version }}
6078

6179
# Capacitor plugin: bump npm version + optional native SDK pins
6280
update_version:
63-
needs: prep
81+
needs: [determine_version, prep]
6482
runs-on: macos-latest
6583
outputs:
6684
capacitor_from: ${{ steps.current_versions.outputs.capacitor_from }}
@@ -154,9 +172,9 @@ jobs:
154172
git commit -m "Update iOS SDK to ${VERSION}" && git push
155173
156174
- name: Update sdk version
175+
env:
176+
NEW_VERSION: ${{ needs.determine_version.outputs.capacitor_version }}
157177
run: |
158-
NEW_VERSION="${{ inputs.capacitor_version }}"
159-
160178
# Convert version format for OneSignal wrapper (e.g., 1.2.15 -> 010215)
161179
# For pre-releases, extract base version first (e.g., 1.2.15-alpha.1 -> 1.2.15)
162180
BASE_VERSION=$(echo "$NEW_VERSION" | sed 's/-[a-z].*//')
@@ -177,13 +195,15 @@ jobs:
177195
git commit -m "Release $NEW_VERSION" && git push
178196
179197
- name: Regenerate API docs
198+
env:
199+
NEW_VERSION: ${{ needs.determine_version.outputs.capacitor_version }}
180200
run: |
181201
vp run docgen
182202
183203
# Only commit if there are changes
184204
git add -A
185205
git diff --staged --quiet && exit 0
186-
git commit -m "Regenerate docs for ${{ inputs.capacitor_version }}" && git push
206+
git commit -m "Regenerate docs for $NEW_VERSION" && git push
187207
188208
create-pr:
189209
needs: [prep, update_version]

0 commit comments

Comments
 (0)