From f836cd5dd882d2dd50c1a98005ba428a42c17927 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Fri, 10 Apr 2026 16:04:49 -0400 Subject: [PATCH 1/3] chore: add templates for PR, bug report, and feature request --- .github/ISSUE_TEMPLATE/bug-report.yml | 87 +++++++++++++++++++ .github/ISSUE_TEMPLATE/feature-request.yml | 54 ++++++++++++ .../pull_request_template.md | 34 ++++++++ 3 files changed, 175 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug-report.yml create mode 100644 .github/ISSUE_TEMPLATE/feature-request.yml create mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..f79011f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,87 @@ +name: Bug Report +description: File a bug report +title: "" +labels: ["triage"] +type: "bug" +body: + - type: markdown + attributes: + value: | + ## Thanks for taking the time to fill out this bug report! + Before creating a bug report, be sure to keep the following points in mind: + - Search existing reports to make sure there isn't already an existing bug report. + - Make sure this is the correct project for your report. If the report is related to a plugin or Capacitor core, create the bug report on that GitHub project instead. + - Feel free to chat with us in [discussions](https://github.com/ionic-team/capacitor/discussions) if you are unsure whether something is a bug or feature request. + - type: textarea + id: description + attributes: + label: Description + description: "Give a detailed explanation of the bug you've encountered." + validations: + required: true + - type: textarea + id: expected-behavior + attributes: + label: Expected Behavior + description: "Describe what you expected to happen, or what should be the correct behavior." + validations: + required: true + - type: input + id: reproduction + attributes: + label: Reproduction + description: "Include a link to a minimal test project that demonstrates the bug." + validations: + required: false + - type: textarea + id: media + attributes: + label: Screenshots / Media + description: "Include screenshots, video recordings or other collateral that helps illustrate the problem described in the bug." + validations: + required: false + - type: textarea + id: env-details + attributes: + label: Environment Details + description: "Please provide the following information with your request and any other relevant technical details (versions of IDEs, local environment info, plugin information or links, etc)." + placeholder: | + OS version: + `npx cap doctor` output: + npm --version output: + node --version output: + pod --version output (iOS Cocoapods issues only): + render: Shell + validations: + required: false + - type: checkboxes + id: versions-affected + attributes: + label: Versions Affected + description: "Check the versions that this bug is related to." + options: + - label: 7.x + required: false + - label: 8.x + required: false + - label: 9.x + required: false + - type: checkboxes + id: platforms-affected + attributes: + label: Platforms Affected + description: "Check the platforms that this bug is related to." + options: + - label: iOS + required: false + - label: Android + required: false + - label: Web + required: false + - type: textarea + id: notes + attributes: + label: Notes / Comments + description: "Anything else we need to know to help? Include it here." + validations: + required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..57bfb33 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,54 @@ +name: Feature Request +description: Request a new feature +title: "" +labels: ["triage"] +type: "feature" +body: + - type: markdown + attributes: + value: | + ## Thanks for your input on enhancements to Capacitor! + Before creating a feature request, be sure to keep the following points in mind: + - Search existing feature requests to make sure there isn't already an existing request. + - Make sure this is the correct project for your request. If the request is related to a plugin or Capacitor core, create the request on that relevant GitHub project instead. + - Make sure feature requests are relevant to the goals of the project. If you are unsure, feel free to chat with us in [discussions](https://github.com/ionic-team/capacitor/discussions). + - type: textarea + id: description + attributes: + label: Feature Description + description: "Describe the feature you would like to see." + validations: + required: true + - type: textarea + id: implementation + attributes: + label: Potential Implementation + description: "Describe any potential implementation or preferred solution for this feature, or examples of solutions in the wild." + validations: + required: false + - type: checkboxes + id: supported-platforms + attributes: + label: Supported Platforms + description: "Check the platforms this feature request is relevant to." + options: + - label: iOS + required: false + - label: Android + required: false + - label: Web + required: false + - type: textarea + id: alternatives + attributes: + label: Alternatives + description: "Describe some alternatives, if any." + validations: + required: false + - type: textarea + id: notes + attributes: + label: Notes / Comments + description: "Include any other information about the feature request here, for example, potential use cases, benefits, etc." + validations: + required: false \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 0000000..7a492f9 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,34 @@ +## Description + + +## Change Type +- [ ] Fix +- [ ] Feature +- [ ] Refactor +- [ ] Breaking Change +- [ ] Documentation + +## Rationale / Problems Fixed + + + +## Tests or Reproductions + + + + +## Screenshots / Media + + +## Versions Affected +- [ ] 7.x +- [ ] 8.x +- [ ] 9.x + +## Platforms Affected +- [ ] Android +- [ ] iOS +- [ ] Web + +## Notes / Comments + \ No newline at end of file From d594ebb8d4bc51c0177e26669c5ba7a6ad486267 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Fri, 10 Apr 2026 16:35:01 -0400 Subject: [PATCH 2/3] chore: configure release workflows (based on other Capacitor plugins) --- .../publish_android_maven_central.yml | 50 +++++++++++ .../workflows/publish_ios_cocoapods_trunk.yml | 39 +++++++++ .github/workflows/release_plugin.yml | 68 +++++++++++++++ android/build.gradle | 4 +- package.json | 8 +- release.config.cjs | 33 ++++++++ scripts/android/publish-module.gradle | 82 +++++++++++++++++++ scripts/android/publish-root.gradle | 44 ++++++++++ scripts/publish-android.sh | 77 +++++++++++++++++ scripts/publish-ios.sh | 46 +++++++++++ 10 files changed, 448 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish_android_maven_central.yml create mode 100644 .github/workflows/publish_ios_cocoapods_trunk.yml create mode 100644 .github/workflows/release_plugin.yml create mode 100644 release.config.cjs create mode 100644 scripts/android/publish-module.gradle create mode 100644 scripts/android/publish-root.gradle create mode 100644 scripts/publish-android.sh create mode 100644 scripts/publish-ios.sh diff --git a/.github/workflows/publish_android_maven_central.yml b/.github/workflows/publish_android_maven_central.yml new file mode 100644 index 0000000..f414164 --- /dev/null +++ b/.github/workflows/publish_android_maven_central.yml @@ -0,0 +1,50 @@ +name: Publish Capacitor Plugin to Maven Central + +on: + workflow_call: + secrets: + ANDROID_CENTRAL_USERNAME: + required: true + ANDROID_CENTRAL_PASSWORD: + required: true + ANDROID_SIGNING_KEY_ID: + required: true + ANDROID_SIGNING_PASSWORD: + required: true + ANDROID_SIGNING_KEY: + required: true + ANDROID_SONATYPE_STAGING_PROFILE_ID: + required: true + CAP_GH_RELEASE_TOKEN: + required: true + workflow_dispatch: + +jobs: + publish-android: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + timeout-minutes: 60 + permissions: + contents: read + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + ref: ${{ github.ref_name }} # explicitly set ref to include commit from `semantic-release` + token: ${{ secrets.CAP_GH_RELEASE_TOKEN }} + - name: set up JDK 21 + uses: actions/setup-java@v5 + with: + java-version: '21' + distribution: 'zulu' + - name: Grant execute permission for publishing script + run: chmod +x ./scripts/publish-android.sh + - name: Run publish script + env: + ANDROID_CENTRAL_USERNAME: ${{ secrets.ANDROID_CENTRAL_USERNAME }} + ANDROID_CENTRAL_PASSWORD: ${{ secrets.ANDROID_CENTRAL_PASSWORD }} + ANDROID_SIGNING_KEY_ID: ${{ secrets.ANDROID_SIGNING_KEY_ID }} + ANDROID_SIGNING_PASSWORD: ${{ secrets.ANDROID_SIGNING_PASSWORD }} + ANDROID_SIGNING_KEY: ${{ secrets.ANDROID_SIGNING_KEY }} + ANDROID_SONATYPE_STAGING_PROFILE_ID: ${{ secrets.ANDROID_SONATYPE_STAGING_PROFILE_ID }} + run: ./scripts/publish-android.sh diff --git a/.github/workflows/publish_ios_cocoapods_trunk.yml b/.github/workflows/publish_ios_cocoapods_trunk.yml new file mode 100644 index 0000000..412a24f --- /dev/null +++ b/.github/workflows/publish_ios_cocoapods_trunk.yml @@ -0,0 +1,39 @@ +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.0.app + - run: xcrun simctl list > /dev/null + - run: xcodebuild -downloadPlatform iOS + - uses: actions/setup-node@v6 + with: + node-version: 22 + - uses: actions/checkout@v6 + 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: Grant execute permission for publishing script + run: chmod +x ./scripts/publish-ios.sh + - name: Deploy to Cocoapods + env: + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} + run: | + set -eo pipefail + ./scripts/publish-ios.sh diff --git a/.github/workflows/release_plugin.yml b/.github/workflows/release_plugin.yml new file mode 100644 index 0000000..6592556 --- /dev/null +++ b/.github/workflows/release_plugin.yml @@ -0,0 +1,68 @@ +name: "Release Plugin" + +on: + push: + branches: + - development + - next + workflow_dispatch: + +permissions: + contents: write + issues: write + deployments: write + id-token: write # to enable use of OIDC for npm provenance and trusted publishing + +jobs: + setup: + uses: ./.github/workflows/reusable_setup.yml + secrets: + THE_GH_RELEASE_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }} + + lint: + needs: 'setup' + uses: ./.github/workflows/reusable_lint.yml + secrets: + THE_GH_RELEASE_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }} + + build-packages: + needs: 'setup' + uses: ./.github/workflows/reusable_build.yml + secrets: + THE_GH_RELEASE_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }} + + release: + needs: ['setup','lint','build-packages'] + runs-on: 'ubuntu-latest' + timeout-minutes: 30 + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + token: ${{ secrets.CAP_GH_RELEASE_TOKEN }} + - name: 'Setup Tools' + uses: ./.github/actions/setup-tools + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }} + GH_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }} + run: npx semantic-release + + publish-android: + needs: ['release'] + uses: ./.github/workflows/publish_android_maven_central.yml + secrets: + ANDROID_CENTRAL_USERNAME: ${{ secrets.ANDROID_CENTRAL_USERNAME }} + ANDROID_CENTRAL_PASSWORD: ${{ secrets.ANDROID_CENTRAL_PASSWORD }} + ANDROID_SIGNING_KEY_ID: ${{ secrets.ANDROID_SIGNING_KEY_ID }} + ANDROID_SIGNING_KEY: ${{ secrets.ANDROID_SIGNING_KEY }} + ANDROID_SIGNING_PASSWORD: ${{ secrets.ANDROID_SIGNING_PASSWORD }} + ANDROID_SONATYPE_STAGING_PROFILE_ID: ${{ secrets.ANDROID_SONATYPE_STAGING_PROFILE_ID }} + CAP_GH_RELEASE_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }} + + publish-ios: + needs: ['release'] + uses: ./.github/workflows/publish_ios_cocoapods_trunk.yml + secrets: + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} + CAP_GH_RELEASE_TOKEN: ${{ secrets.CAP_GH_RELEASE_TOKEN }} diff --git a/android/build.gradle b/android/build.gradle index d03df6c..fd38460 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -30,8 +30,8 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' if (System.getenv("CAP_PLUGIN_PUBLISH") == "true") { apply plugin: 'io.github.gradle-nexus.publish-plugin' - apply from: file('../../scripts/android/publish-root.gradle') - apply from: file('../../scripts/android/publish-module.gradle') + apply from: file('../scripts/android/publish-root.gradle') + apply from: file('../scripts/android/publish-module.gradle') } android { diff --git a/package.json b/package.json index 5a3a2b6..e6d205d 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,13 @@ "rimraf": "^6.1.0", "rollup": "^4.53.2", "swiftlint": "^2.0.0", - "typescript": "^5.9.3" + "typescript": "^5.9.3", + "@semantic-release/changelog": "^6.0.3", + "@semantic-release/exec": "^7.1.0", + "@semantic-release/git": "^10.0.1", + "@semantic-release/github": "^12.0.2", + "@semantic-release/npm": "^13.1.2", + "semantic-release": "^25.0.2" }, "peerDependencies": { "@capacitor/core": ">=8.0.0" diff --git a/release.config.cjs b/release.config.cjs new file mode 100644 index 0000000..9b4c328 --- /dev/null +++ b/release.config.cjs @@ -0,0 +1,33 @@ +module.exports = { + branches: [ + { name: 'main', channel: 'latest' }, + { name: 'next', channel: 'next', prerelease: true }, + { name: 'development', channel: 'dev', prerelease: true } + ], + repositoryUrl: 'https://github.com/ionic-team/capacitor-camera.git', + plugins: [ + '@semantic-release/commit-analyzer', + '@semantic-release/release-notes-generator', + '@semantic-release/changelog', + '@semantic-release/npm', + [ + '@semantic-release/github', + { + successComment: false, + failComment: false, + releasedLabels: false, + addReleases: 'bottom', + releaseNotes: { + changelogFile: 'CHANGELOG.md' + } + } + ], + [ + '@semantic-release/git', + { + assets: ['CHANGELOG.md', 'package.json'], + message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}' + } + ] + ] +}; diff --git a/scripts/android/publish-module.gradle b/scripts/android/publish-module.gradle new file mode 100644 index 0000000..bea1e3f --- /dev/null +++ b/scripts/android/publish-module.gradle @@ -0,0 +1,82 @@ +apply plugin: 'maven-publish' +apply plugin: 'signing' + +def LIB_VERSION = System.getenv('PLUGIN_VERSION') +def PLUGIN_NAME = System.getenv('PLUGIN_NAME') +def PLUGIN_REPO = System.getenv('PLUGIN_REPO') +def PLUGIN_SCM = System.getenv('PLUGIN_SCM') + +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + if (project.plugins.findPlugin("com.android.library")) { + from android.sourceSets.main.java.srcDirs + from android.sourceSets.main.kotlin.srcDirs + } else { + from sourceSets.main.java.srcDirs + from sourceSets.main.kotlin.srcDirs + } +} + +artifacts { + archives androidSourcesJar +} + +group = 'com.capacitorjs' +version = LIB_VERSION + +afterEvaluate { + publishing { + publications { + release(MavenPublication) { + // Coordinates + groupId 'com.capacitorjs' + artifactId PLUGIN_NAME + version LIB_VERSION + + // Two artifacts, the `aar` (or `jar`) and the sources + if (project.plugins.findPlugin("com.android.library")) { + from components.release + } else { + artifact("$buildDir/libs/${project.getName()}-${version}.jar") + } + + artifact androidSourcesJar + + // POM Data + pom { + name = PLUGIN_NAME + description = 'Capacitor Android ' + PLUGIN_NAME + ' plugin native library' + url = PLUGIN_REPO + licenses { + license { + name = 'MIT' + url = PLUGIN_REPO + '/blob/main' + '/LICENSE' + } + } + developers { + developer { + name = 'Ionic' + email = 'hi@ionic.io' + } + } + + // Version Control Info + scm { + connection = 'scm:git:' + PLUGIN_SCM + '.git' + developerConnection = 'scm:git:ssh://' + PLUGIN_SCM + '.git' + url = PLUGIN_REPO + '/tree/main' + } + } + } + } + } +} + +signing { + useInMemoryPgpKeys( + rootProject.ext["signing.keyId"], + rootProject.ext["signing.key"], + rootProject.ext["signing.password"], + ) + sign publishing.publications +} diff --git a/scripts/android/publish-root.gradle b/scripts/android/publish-root.gradle new file mode 100644 index 0000000..53ccc94 --- /dev/null +++ b/scripts/android/publish-root.gradle @@ -0,0 +1,44 @@ +// Create variables with empty default values +ext["signing.keyId"] = '' +ext["signing.key"] = '' +ext["signing.password"] = '' +ext["centralTokenUsername"] = '' +ext["centralTokenPassword"] = '' +ext["sonatypeStagingProfileId"] = '' + +File globalSecretPropsFile = file('../scripts/android/local.properties') +File secretPropsFile = project.rootProject.file('local.properties') +if (globalSecretPropsFile.exists()) { + println "Reading globalSecretPropsFile" + // Read global local.properties file first if it exists (scripts/android/local.properties) + Properties p = new Properties() + new FileInputStream(globalSecretPropsFile).withCloseable { is -> p.load(is) } + p.each { name, value -> ext[name] = value } +} else if (secretPropsFile.exists()) { + // Read plugin project specific local.properties file next if it exists + Properties p = new Properties() + new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) } + p.each { name, value -> ext[name] = value } +} else { + // Use system environment variables + ext["centralTokenUsername"] = System.getenv('ANDROID_CENTRAL_USERNAME') + ext["centralTokenPassword"] = System.getenv('ANDROID_CENTRAL_PASSWORD') + ext["sonatypeStagingProfileId"] = System.getenv('ANDROID_SONATYPE_STAGING_PROFILE_ID') + ext["signing.keyId"] = System.getenv('ANDROID_SIGNING_KEY_ID') + ext["signing.key"] = System.getenv('ANDROID_SIGNING_KEY') + ext["signing.password"] = System.getenv('ANDROID_SIGNING_PASSWORD') +} + +// Set up Sonatype repository +nexusPublishing { + repositories { + sonatype { + stagingProfileId = sonatypeStagingProfileId + username = centralTokenUsername + password = centralTokenPassword + nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) + snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/")) + } + } + repositoryDescription = 'Capacitor Android ' + System.getenv('PLUGIN_NAME') + ' plugin v' + System.getenv('PLUGIN_VERSION') +} diff --git a/scripts/publish-android.sh b/scripts/publish-android.sh new file mode 100644 index 0000000..2e51d60 --- /dev/null +++ b/scripts/publish-android.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +publish_plugin_android () { + PLUGIN_PATH=$1 + if [ -d "$PLUGIN_PATH" ]; then + # Android dir path + ANDROID_PATH=$PLUGIN_PATH/android + GRADLE_FILE=$ANDROID_PATH/build.gradle + + # Only try to publish if the directory contains a package.json and android package + if test -f "$PLUGIN_PATH/package.json" && test -d "$ANDROID_PATH" && test -f "$GRADLE_FILE"; then + PLUGIN_VERSION=$(grep '"version": ' "$PLUGIN_PATH"/package.json | awk '{print $2}' | tr -d '",') + PLUGIN_NAME=$(grep '"name": ' "$PLUGIN_PATH"/package.json | awk '{print $2}' | tr -d '",') + PLUGIN_NAME=${PLUGIN_NAME#@capacitor/} + LOG_OUTPUT=./tmp/$PLUGIN_NAME.txt + + # Get latest plugin info from MavenCentral + PLUGIN_PUBLISHED_URL="https://repo1.maven.org/maven2/com/capacitorjs/$PLUGIN_NAME/maven-metadata.xml" + PLUGIN_PUBLISHED_DATA=$(curl -s $PLUGIN_PUBLISHED_URL) + PLUGIN_PUBLISHED_VERSION="$(perl -ne 'print and last if s/.*(.*)<\/latest>.*/\1/;' <<< $PLUGIN_PUBLISHED_DATA)" + + if [[ $PLUGIN_VERSION == $PLUGIN_PUBLISHED_VERSION ]]; then + printf %"s\n\n" "Duplicate: a published plugin $PLUGIN_NAME exists for version $PLUGIN_VERSION, skipping..." + else + # Make log dir if doesnt exist + mkdir -p ./tmp + + printf %"s\n" "Attempting to build and publish plugin $PLUGIN_NAME for version $PLUGIN_VERSION to production..." + + # Export ENV variables used by Gradle for the plugin + export PLUGIN_NAME + export PLUGIN_VERSION + export CAPACITOR_VERSION + export CAP_PLUGIN_PUBLISH=true + export PLUGIN_REPO="https://github.com/ionic-team/capacitor-camera" + export PLUGIN_SCM="github.com:ionic-team/capacitor-camera" + + # Build and publish + "$ANDROID_PATH"/gradlew clean build publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --no-daemon --max-workers 1 -b "$ANDROID_PATH"/build.gradle -Pandroid.useAndroidX=true > $LOG_OUTPUT 2>&1 + + if grep --quiet "BUILD SUCCESSFUL" $LOG_OUTPUT; then + printf %"s\n\n" "Success: $PLUGIN_NAME published to MavenCentral." + else + printf %"s\n\n" "Error publishing $PLUGIN_NAME, check $LOG_OUTPUT for more info! Manually review and release from the Central Portal may be necessary https://central.sonatype.com/publishing/deployments/" + cat $LOG_OUTPUT + exit 1 + fi + fi + else + printf %"s\n\n" "$PLUGIN_PATH does not appear to be a plugin (has no package.json file or Android package), skipping..." + fi + fi +} + +# Get latest com.capacitorjs:core XML version info +CAPACITOR_PUBLISHED_URL="https://repo1.maven.org/maven2/com/capacitorjs/core/maven-metadata.xml" +CAPACITOR_PUBLISHED_DATA=$(curl -s $CAPACITOR_PUBLISHED_URL) +CAPACITOR_PUBLISHED_VERSION="$(perl -ne 'print and last if s/.*(.*)<\/latest>.*/\1/;' <<< $CAPACITOR_PUBLISHED_DATA)" + +printf %"s\n" "The latest published Android library version of Capacitor Core is $CAPACITOR_PUBLISHED_VERSION in MavenCentral." + +# Determine Capacitor Version to use as gradle dependency. +STABLE_PART=$(echo "$CAPACITOR_PUBLISHED_VERSION" | cut -d'-' -f1) +IFS='.' read -r MAJOR MINOR PATCH <<< "$STABLE_PART" +if [[ "$CAPACITOR_PUBLISHED_VERSION" == *"-"* ]]; then + # prerelease - go one major lower (latest stable major), but also allow next upcoming major + PREV_MAJOR=$((MAJOR - 1)) + NEXT_MAJOR=$((MAJOR + 1)) + CAPACITOR_VERSION="[$PREV_MAJOR.0,$NEXT_MAJOR.0)" +else + # stable - current major range + NEXT_MAJOR=$((MAJOR + 1)) + CAPACITOR_VERSION="[$MAJOR.0,$NEXT_MAJOR.0)" +fi +printf %"s\n" "Publishing plugin with dependency on Capacitor version $CAPACITOR_VERSION" + +publish_plugin_android '.' diff --git a/scripts/publish-ios.sh b/scripts/publish-ios.sh new file mode 100644 index 0000000..1961cda --- /dev/null +++ b/scripts/publish-ios.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +publish_plugin_ios () { + PLUGIN_PATH=$1 + # Only try to publish if the directory contains a package.json podspec file + if ! test -f "$PLUGIN_PATH/package.json"; then + printf %"s\n\n" "$PLUGIN_PATH does not appear to be a plugin (has no package.json), skipping..." + return + fi + + PLUGIN_VERSION=$(grep '"version": ' "$PLUGIN_PATH"/package.json | awk '{print $2}' | tr -d '",') + PLUGIN_NAME=$(grep '"name": ' "$PLUGIN_PATH"/package.json | awk '{print $2}' | tr -d '",') + PLUGIN_NAME=${PLUGIN_NAME#@capacitor/} + # capitalize the name, because .podspec file name is capitalized + first_char=$(printf '%s' "$PLUGIN_NAME" | cut -c1 | tr '[:lower:]' '[:upper:]') + rest=$(printf '%s' "$PLUGIN_NAME" | cut -c2-) + PLUGIN_NAME="${first_char}${rest}" + POD_NAME="Capacitor$PLUGIN_NAME" + PODSPEC_FILE_PATH="$PLUGIN_PATH/$POD_NAME.podspec" + if ! test -f $PODSPEC_FILE_PATH; then + printf %"s\n\n" "Was looking for podspec file $PODSPEC_FILE_PATH, but does not seem to exist, skipping..." + return + fi + + # check if version already exists in Trunk + if pod trunk info "$POD_NAME" 2>/dev/null | grep -q " - $PLUGIN_VERSION ("; then + printf %"s\n\n" "Duplicate: a published plugin $PLUGIN_NAME exists for version $PLUGIN_VERSION, skipping..." + return + fi + + LOG_OUTPUT=./tmp/$PLUGIN_NAME.txt + # Make log dir if doesnt exist + mkdir -p ./tmp + # publish to Trunk + printf %"s\n" "Attempting to build and publish plugin $PLUGIN_NAME for version $PLUGIN_VERSION to production..." + pod trunk push $PODSPEC_FILE_PATH --allow-warnings > $LOG_OUTPUT 2>&1 + if grep -q "passed" $LOG_OUTPUT; then + printf %"s\n\n" "Success: $PLUGIN_NAME published to CocoaPods Trunk." + else + printf %"s\n\n" "Error publishing $PLUGIN_NAME, check $LOG_OUTPUT for more info!" + cat $LOG_OUTPUT + exit 1 + fi +} + +publish_plugin_ios '.' From 814564f4bbc8c2ad517879bca27bd5b881cc32dc Mon Sep 17 00:00:00 2001 From: OS-pedrogustavobilro Date: Mon, 13 Apr 2026 15:57:38 +0100 Subject: [PATCH 3/3] chore: delete github templates for now --- .github/ISSUE_TEMPLATE/bug-report.yml | 87 ------------------- .github/ISSUE_TEMPLATE/feature-request.yml | 54 ------------ .../pull_request_template.md | 34 -------- 3 files changed, 175 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug-report.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature-request.yml delete mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml deleted file mode 100644 index f79011f..0000000 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Bug Report -description: File a bug report -title: "" -labels: ["triage"] -type: "bug" -body: - - type: markdown - attributes: - value: | - ## Thanks for taking the time to fill out this bug report! - Before creating a bug report, be sure to keep the following points in mind: - - Search existing reports to make sure there isn't already an existing bug report. - - Make sure this is the correct project for your report. If the report is related to a plugin or Capacitor core, create the bug report on that GitHub project instead. - - Feel free to chat with us in [discussions](https://github.com/ionic-team/capacitor/discussions) if you are unsure whether something is a bug or feature request. - - type: textarea - id: description - attributes: - label: Description - description: "Give a detailed explanation of the bug you've encountered." - validations: - required: true - - type: textarea - id: expected-behavior - attributes: - label: Expected Behavior - description: "Describe what you expected to happen, or what should be the correct behavior." - validations: - required: true - - type: input - id: reproduction - attributes: - label: Reproduction - description: "Include a link to a minimal test project that demonstrates the bug." - validations: - required: false - - type: textarea - id: media - attributes: - label: Screenshots / Media - description: "Include screenshots, video recordings or other collateral that helps illustrate the problem described in the bug." - validations: - required: false - - type: textarea - id: env-details - attributes: - label: Environment Details - description: "Please provide the following information with your request and any other relevant technical details (versions of IDEs, local environment info, plugin information or links, etc)." - placeholder: | - OS version: - `npx cap doctor` output: - npm --version output: - node --version output: - pod --version output (iOS Cocoapods issues only): - render: Shell - validations: - required: false - - type: checkboxes - id: versions-affected - attributes: - label: Versions Affected - description: "Check the versions that this bug is related to." - options: - - label: 7.x - required: false - - label: 8.x - required: false - - label: 9.x - required: false - - type: checkboxes - id: platforms-affected - attributes: - label: Platforms Affected - description: "Check the platforms that this bug is related to." - options: - - label: iOS - required: false - - label: Android - required: false - - label: Web - required: false - - type: textarea - id: notes - attributes: - label: Notes / Comments - description: "Anything else we need to know to help? Include it here." - validations: - required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml deleted file mode 100644 index 57bfb33..0000000 --- a/.github/ISSUE_TEMPLATE/feature-request.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Feature Request -description: Request a new feature -title: "" -labels: ["triage"] -type: "feature" -body: - - type: markdown - attributes: - value: | - ## Thanks for your input on enhancements to Capacitor! - Before creating a feature request, be sure to keep the following points in mind: - - Search existing feature requests to make sure there isn't already an existing request. - - Make sure this is the correct project for your request. If the request is related to a plugin or Capacitor core, create the request on that relevant GitHub project instead. - - Make sure feature requests are relevant to the goals of the project. If you are unsure, feel free to chat with us in [discussions](https://github.com/ionic-team/capacitor/discussions). - - type: textarea - id: description - attributes: - label: Feature Description - description: "Describe the feature you would like to see." - validations: - required: true - - type: textarea - id: implementation - attributes: - label: Potential Implementation - description: "Describe any potential implementation or preferred solution for this feature, or examples of solutions in the wild." - validations: - required: false - - type: checkboxes - id: supported-platforms - attributes: - label: Supported Platforms - description: "Check the platforms this feature request is relevant to." - options: - - label: iOS - required: false - - label: Android - required: false - - label: Web - required: false - - type: textarea - id: alternatives - attributes: - label: Alternatives - description: "Describe some alternatives, if any." - validations: - required: false - - type: textarea - id: notes - attributes: - label: Notes / Comments - description: "Include any other information about the feature request here, for example, potential use cases, benefits, etc." - validations: - required: false \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md deleted file mode 100644 index 7a492f9..0000000 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ /dev/null @@ -1,34 +0,0 @@ -## Description - - -## Change Type -- [ ] Fix -- [ ] Feature -- [ ] Refactor -- [ ] Breaking Change -- [ ] Documentation - -## Rationale / Problems Fixed - - - -## Tests or Reproductions - - - - -## Screenshots / Media - - -## Versions Affected -- [ ] 7.x -- [ ] 8.x -- [ ] 9.x - -## Platforms Affected -- [ ] Android -- [ ] iOS -- [ ] Web - -## Notes / Comments - \ No newline at end of file