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
65 changes: 60 additions & 5 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
name: Publish to npm

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
deployment_mode:
description: 'Choose dry-run to validate or publish for real deployment.'
required: true
default: dry-run
type: choice
options:
- dry-run
- publish
tag:
description: "Optional tag override (example: v1.1.4). Leave empty to use v<package.json version>."
required: false
type: string

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
id-token: write

steps:
Expand All @@ -23,11 +36,29 @@ jobs:
node-version: 24
registry-url: 'https://registry.npmjs.org'

- name: Resolve release tag
id: release_tag
run: |
if [ -n "${{ inputs.tag }}" ]; then
TAG="${{ inputs.tag }}"
else
VERSION="$(node -p "require('./package.json').version")"
TAG="v${VERSION}"
fi

if [[ ! "$TAG" =~ ^v[0-9].* ]]; then
echo "Resolved tag must start with 'v' (example: v1.1.4), got: $TAG"
exit 1
fi

echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "Using release tag: $TAG"

- name: Enable Corepack
run: corepack enable

- name: Install dependencies
run: yarn install --immutable
run: yarn install --no-immutable

- name: Typecheck
run: yarn typecheck
Expand All @@ -38,5 +69,29 @@ jobs:
- name: Build package
run: yarn prepare

- name: Publish to npm (dry-run)
if: ${{ inputs.deployment_mode == 'dry-run' }}
run: npm publish --provenance --access public --dry-run

- name: Publish to npm
if: ${{ inputs.deployment_mode == 'publish' }}
run: npm publish --provenance --access public

- name: Ensure git tag exists
if: ${{ inputs.deployment_mode == 'publish' }}
run: |
TAG="${{ steps.release_tag.outputs.tag }}"
git fetch --tags
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists."
else
git tag "$TAG"
git push origin "$TAG"
fi

- name: Create GitHub release
if: ${{ inputs.deployment_mode == 'publish' }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.release_tag.outputs.tag }}
generate_release_notes: true
1 change: 0 additions & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import HomeScreen from './HomeScreen';
import { Routes } from './Routes';
import {
MappIntelligencePlugin,
ExceptionType,
LogLevel,
} from 'mapp-intelligence-reactnative-plugin';
import FetchExample from './FetchExample';
Expand Down
2 changes: 1 addition & 1 deletion example/src/FetchExample.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Alert, FlatList, SafeAreaView } from 'react-native';
import { FlatList, SafeAreaView } from 'react-native';
import { DefaultStyles, Dialog, MappButton } from './components/MappComponents';

const FetchExample = ()=>{
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mapp-intelligence-reactnative-plugin",
"version": "1.1.3",
"version": "1.1.2",
"description": "The MappIntelligence SDK allows you to track user activities, screen flow and media usage for an App. All data is send to the MappIntelligence tracking system for further analysis.",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down Expand Up @@ -29,7 +29,7 @@
"example": "yarn workspace react-native-mappinteligence-plugin-example",
"install:high-mem": "NODE_OPTIONS=--max-old-space-size=8192 yarn install",
"test": "jest",
"typecheck": "tsc --noEmit",
"typecheck": "tsc --noEmit -p tsconfig.build.json",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
"prepare": "bob build",
Expand Down
Loading