Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions .github/workflows/draft-release-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Create draft release

on:
workflow_dispatch: # checkov:skip=CKV_GHA_7
inputs:
bump-type:
description: Specify if the version should be bumped as major, minor, patch
required: true
type: choice
options:
- major
- minor
- patch

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: write
id-token: write

jobs:
publish-draft-release:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Comment thread
jamesnrokt marked this conversation as resolved.

- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 #6.0.0
with:
node-version: 22

- name: Get current version
id: version-file
run: |
version_from_file=$(head -n 1 VERSION)
echo "release-version=$version_from_file" >> $GITHUB_OUTPUT

- name: Bump version
id: bump-version
uses: actions-ecosystem/action-bump-semver@34e334551143a5301f38c830e44a22273c6ff5c5 # v1.0.0
with:
current_version: ${{ steps.version-file.outputs.release-version }}
level: ${{ github.event.inputs.bump-type || 'patch' }}

- name: Save validated version to file
run: |
echo "${{ steps.bump-version.outputs.new_version }}" > VERSION

- name: Test Plugin
working-directory: plugin
run: npm test

- name: Update Plugin package.json
working-directory: plugin
run: |
npm version ${{ steps.bump-version.outputs.new_version }} --no-git-tag-version

- name: Update Rokt Kit package.json
working-directory: Kits/Rokt
run: |
npm version ${{ steps.bump-version.outputs.new_version }} --no-git-tag-version

- name: Publish Plugin to npm (dry-run)
working-directory: plugin
run: npm publish --dry-run

- name: Publish Rokt Kit to npm (dry-run)
working-directory: Kits/Rokt
run: npm publish --dry-run

- name: Update changelog
uses: thomaseizinger/keep-a-changelog-new-release@f62c3c390716df5af712ba5d94f4f4a8efc1306d # v3.1.0
with:
tag: ${{ steps.bump-version.outputs.new_version }}
changelogPath: CHANGELOG.md

- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
with:
app-id: ${{ secrets.SDK_RELEASE_GITHUB_APP_ID }}
private-key: ${{ secrets.SDK_RELEASE_GITHUB_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: |
cordova-plugin-mparticle

- name: Create Pull Request
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: 'Prepare release ${{ steps.bump-version.outputs.new_version }}'
Comment thread
jamesnrokt marked this conversation as resolved.
branch: release/${{ steps.bump-version.outputs.new_version }}
title: 'Prepare release ${{ steps.bump-version.outputs.new_version }}'
base: main
body: |
Preparing for release ${{ steps.bump-version.outputs.new_version }}

There should be 4 files that have been updated:
- plugin/package.json
- Kits/Rokt/package.json
- CHANGELOG.md
- VERSION

Additionally a dry-run publish was successfully run for the plugin and Rokt kit.
labels: |
release
14 changes: 0 additions & 14 deletions .github/workflows/issue-autorespond-and-close.yml

This file was deleted.

78 changes: 78 additions & 0 deletions .github/workflows/release-from-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release NPM

on:
push:
branches:
- main
paths:
- VERSION

permissions:
id-token: write
contents: write

jobs:
setup-and-version:
runs-on: ubuntu-latest
outputs:
final_version: ${{ steps.version-file.outputs.release-version }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2


- name: Get current version
id: version-file
run: |
version_from_file=$(head -n 1 VERSION)
echo "release-version=$version_from_file" >> $GITHUB_OUTPUT

build-and-release:
needs: setup-and-version
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Node.js
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 #6.0.0
with:
node-version: 22
registry-url: https://registry.npmjs.org

- name: Install Plugin dependencies
working-directory: plugin
run: npm ci

- name: Test Plugin
working-directory: plugin
run: npm test

- name: Publish Plugin to npm
working-directory: plugin
run: npm publish

- name: Install Rokt Kit dependencies
working-directory: Kits/Rokt
run: npm ci

- name: Publish Rokt Kit to npm
working-directory: Kits/Rokt
run: npm publish
Comment thread
jamesnrokt marked this conversation as resolved.

- uses: ffurrer2/extract-release-notes@9989ccec43d726ef05aa1cd7b2854fb96b6df6ab # v2.2.0
id: extract-release-notes
with:
changelog_file: CHANGELOG.md

- name: Changelog
run: echo "${{ steps.extract-release-notes.outputs.release_notes }}"

- name: Create Github release
uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0
with:
makeLatest: true
tag: ${{ needs.setup-and-version.outputs.final_version }}
body: |
## Release notes:
${{ steps.extract-release-notes.outputs.release_notes }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ node_modules

example/platforms
example/plugins

# The README.md for the plugin is copied from root during prepublishOnly script
plugin/README.md
12 changes: 12 additions & 0 deletions Kits/Rokt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# cordova-plugin-mparticle-kits-rokt

Cordova plugin that adds mParticle Rokt kit native dependencies to your project.

## What This Plugin Does

This plugin automatically adds the following native dependencies:

- **Android**: `com.mparticle:android-rokt-kit:5.71.0`
- **iOS**: `mParticle-Rokt` version `8.3.0`

No additional configuration needed - just install the plugin and the dependencies will be added automatically when you build your project.
24 changes: 24 additions & 0 deletions Kits/Rokt/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "cordova-plugin-mparticle-kits-rokt",
"version": "2.2.4",
"description": "Adds support for Rokt to your Cordova project",
"homepage": "https://www.mparticle.com",
"repository": {
"type": "git",
"url": "https://github.com/mParticle/cordova-plugin-mparticle",
"directory": "Kits/Rokt"
},
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"provenance": true,
"registry": "https://registry.npmjs.org/"
},
"cordova": {
"id": "cordova-plugin-mparticle-kits-rokt",
"platforms": [
"android",
"ios"
]
}
}
20 changes: 20 additions & 0 deletions Kits/Rokt/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
id="cordova-plugin-mparticle-kits-rokt"
version="2.2.4">
<name>MParticle Rokt Kit</name>
<description>Adds support for Rokt to your Cordova project</description>
<platform name="android">
<framework src="com.mparticle:android-rokt-kit:5.71.0"/>
</platform>
<platform name="ios">
<podspec>
<config>
<source url="https://cdn.cocoapods.org/"/>
</config>
<pods use-frameworks="true">
<pod name="mParticle-Rokt" spec="8.3.0" />
</pods>
</podspec>
</platform>
</plugin>
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.2.4
23 changes: 19 additions & 4 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,20 @@ npm install
- `REPLACE_ME_API_KEY` with your iOS API key
- `REPLACE_ME_API_SECRET` with your iOS API secret

3. Add platforms:
3. (Optional) Add mParticle kit dependencies:

Install kit plugins to add native dependencies. For example, to add the Rokt kit:

```bash
cordova plugin add ../Kits/Rokt
```

Or add it directly in `config.xml`:
```xml
<plugin name="cordova-plugin-mparticle-kits-rokt" spec="../Kits/Rokt" />
```

4. Add platforms:
```bash
cordova platform add android
cordova platform add ios
Expand Down Expand Up @@ -64,8 +77,10 @@ cordova platform add android ios

## Project Structure

- `platform_overrides/` - Contains platform-specific customizations
- `android/` - Android-specific files (MainActivity.java)
- `ios/` - iOS-specific files (AppDelegate.m)
- `platform_overrides/` - Platform-specific files that are automatically copied during platform setup
- `android/MainActivity.java` - Android app entry point
- `ios/AppDelegate.m` - iOS app delegate
- `Kits/` - mParticle kit dependency plugins
- `Rokt/` - Rokt kit plugin (adds native dependencies)
- `www/` - Web assets and Cordova application code
- `hooks/` - Scripts that run during Cordova commands
6 changes: 2 additions & 4 deletions example/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@
</platform>
<platform name="ios">
<preference name="deployment-target" value="12.0" />
<preference name="pods_ios_min_version" value="12.0" />
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>

<!-- Platform-specific file copy hook -->
<hook type="after_platform_add" src="hooks/after_platform_add/010_copy_platform_specific_files.js" />
<!-- Run pod install for iOS -->
<hook type="after_platform_add" src="hooks/after_platform_add/020_run_pod_install.js" />
<!-- Update Android Gradle dependencies -->
<hook type="after_platform_add" src="hooks/after_platform_add/030_update_android_gradle.js" />
<plugin name="cordova-plugin-mparticle" spec="../plugin" />
<plugin name="cordova-plugin-mparticle-kits-rokt" spec="../Kits/Rokt" />
</widget>
45 changes: 0 additions & 45 deletions example/hooks/after_platform_add/020_run_pod_install.js

This file was deleted.

Loading