Skip to content
Open
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
47 changes: 1 addition & 46 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ run_always: &run_always
tags:
only: /.*/

# Only run on release
run_on_release: &run_on_release
filters:
tags:
only: /.*/
branches:
ignore: /.*/

commands:
attach_project:
steps:
Expand Down Expand Up @@ -204,29 +196,6 @@ jobs:
path: ~/.maestro/tests
destination: maestro-tests

release-to-npm:
executor: default
steps:
- checkout
- run:
name: Add npm registry auth key
command: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/project/.npmrc
npm config set scope $ORG_NAME

- restore_cache:
keys:
- dependencies-{{ checksum "package.json" }}

- run:
name: Install dependencies
command: |
yarn install

- run:
name: Publish the package
command: npm publish

workflows:
version: 2.1
build-and-test:
Expand Down Expand Up @@ -265,18 +234,4 @@ workflows:
# - lint
# - typescript
# - unit-tests
# - build-package

- release-to-npm:
<<: *run_on_release
context:
- react-native-context
requires:
- install-dependencies
- lint
- typescript
- unit-tests
- build-package
# Temporarily removed e2e test dependencies
# - ios-e2e-test
# - android-e2e-test
# - build-package
108 changes: 108 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Release to npm

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Tag to publish (e.g., 9.5.0)'
required: true
type: string

jobs:
validate:
name: Validate Release
runs-on: ubuntu-latest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really want latest? will this backfire when the node versions miss match in the future?
I see it as a future-risk, but not really right now.

this is just a nit btw

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wouldn't be a concern in this case we are pinning the OS of the GH Action runner, not Node. Node is still pinned to 22.14.0

https://github.com/intercom/intercom-react-native/pull/360/changes/BASE..290093698d7ef8078a1d6962858bf1beefb0fde9#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R57

outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || github.event.inputs.tag }}

- name: Extract and validate version
id: version
run: |
TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}"
VERSION="${TAG#v}"

if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'; then
echo "Error: Invalid version format: $VERSION"
exit 1
fi

PKG_VERSION=$(node -p "require('./package.json').version")
if [ "$VERSION" != "$PKG_VERSION" ]; then
echo "Error: Tag version ($VERSION) does not match package.json version ($PKG_VERSION)"
exit 1
fi

echo "version=$VERSION" >> $GITHUB_OUTPUT

test:
name: Test
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || github.event.inputs.tag }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.14.0'
cache: 'yarn'

- name: Enable Corepack
run: corepack enable

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

- name: Lint
run: yarn lint

- name: TypeScript
run: yarn typescript

- name: Unit tests
run: yarn test

- name: Build package
run: yarn prepare

publish:
name: Publish to npm
runs-on: ubuntu-latest
needs: [validate, test]
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || github.event.inputs.tag }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.14.0'
cache: 'yarn'
registry-url: 'https://registry.npmjs.org'

- name: Enable Corepack
run: corepack enable

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

- name: Build package
run: yarn prepare

- name: Publish to npm
run: npm publish --access public