Skip to content

Commit

Permalink
Add release workflow + CI updates (#6)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Shenshin <[email protected]>
  • Loading branch information
AlexanderShenshin authored May 2, 2024
1 parent 519571e commit 8d61216
Show file tree
Hide file tree
Showing 17 changed files with 167 additions and 144 deletions.
6 changes: 4 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: 'yarn'
registry-url: 'https://registry.npmjs.org/'

- name: Cache dependencies
id: yarn-cache
Expand All @@ -23,5 +25,5 @@ runs:
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
run: yarn install --frozen-lockfile
shell: bash
45 changes: 14 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,41 @@
name: CI
name: Continuous integration

on:
pull_request:
branches:
- main

jobs:
lint:
verify:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
- name: Setup Node.js and install dependencies
uses: ./.github/actions/setup

- name: Lint files
run: yarn lint

- name: Typecheck files
- name: Typecheck
run: yarn typecheck

test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Lint
run: yarn lint

- name: Setup
uses: ./.github/actions/setup
- name: Build library
run: yarn prepare

- name: Run unit tests
run: yarn test --maxWorkers=2 --coverage

build-library:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Build package
run: yarn prepare

build-android:
runs-on: ubuntu-latest
env:
TURBO_CACHE_DIR: .turbo/android
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
- name: Setup Node.js and install dependencies
uses: ./.github/actions/setup

- name: Cache turborepo for Android
Expand Down Expand Up @@ -106,9 +89,9 @@ jobs:
TURBO_CACHE_DIR: .turbo/ios
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup
- name: Setup Node.js and install dependencies
uses: ./.github/actions/setup

- name: Cache turborepo for iOS
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Create a new release and publish NPM package

on:
workflow_dispatch:

# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js and install dependencies
uses: ./.github/actions/setup

- name: Setup NPM config
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Setup Git user
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
- name: Run release
run: yarn release --ci --no-increment
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .release-it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"git": {
"requireBranch": "main",
"commitMessage": "Release ${version}",
"tagName": "v${version}"
},
"hooks": {
"before:init": ["yarn typecheck", "yarn lint", "yarn prepare"]
},
"npm": {
"publish": true
},
"github": {
"release": true
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ React Native wrapper for EUDI wallet reference libraries:
## Installation

```sh
npm install eudi-wallet-kit-react-native
npm install @openwallet-foundation/eudi-wallet-kit-react-native
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "eudi-wallet-kit-react-native-example",
"name": "@openwallet-foundation/eudi-wallet-kit-react-native-example",
"version": "0.0.1",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion example/src/components/modals/AddDocumentModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EudiWallet } from 'eudi-wallet-kit-react-native'
import { EudiWallet } from '@openwallet-foundation/eudi-wallet-kit-react-native'
import React, { useCallback, useState } from 'react'
import { Button, Modal, StyleSheet, Text, View, SafeAreaView } from 'react-native'

Expand Down
4 changes: 2 additions & 2 deletions example/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { EudiWalletConfig } from 'eudi-wallet-kit-react-native'
import type { EudiWalletConfig } from '@openwallet-foundation/eudi-wallet-kit-react-native'

import { ClientIdSchemeType } from 'eudi-wallet-kit-react-native'
import { ClientIdSchemeType } from '@openwallet-foundation/eudi-wallet-kit-react-native'

import { EncryptionAlgorithm, EncryptionMethod } from '../../src/config/Encryption'

Expand Down
6 changes: 5 additions & 1 deletion example/src/navigation/RootStack.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import {
type DisclosedDocument,
EudiWallet,
TransferEventType,
} from '@openwallet-foundation/eudi-wallet-kit-react-native'
import { useNavigation } from '@react-navigation/native'
import { createNativeStackNavigator, type NativeStackNavigationProp } from '@react-navigation/native-stack'
import { type DisclosedDocument, EudiWallet, TransferEventType } from 'eudi-wallet-kit-react-native'
import React, { useEffect, useState } from 'react'
import { Alert } from 'react-native'

Expand Down
2 changes: 1 addition & 1 deletion example/src/screens/DocumentsList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EudiWallet, type Document } from 'eudi-wallet-kit-react-native'
import { EudiWallet, type Document } from '@openwallet-foundation/eudi-wallet-kit-react-native'
import React, { useEffect, useState } from 'react'
import { FlatList, StyleSheet, Text, View } from 'react-native'

Expand Down
2 changes: 1 addition & 1 deletion example/src/screens/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EudiWallet } from 'eudi-wallet-kit-react-native'
import { EudiWallet } from '@openwallet-foundation/eudi-wallet-kit-react-native'
import React from 'react'
import { Button, Text, View } from 'react-native'
import { SafeAreaView } from 'react-native-safe-area-context'
Expand Down
2 changes: 1 addition & 1 deletion example/src/screens/ProximityPresentation.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { MainTabStackParams, Screens } from '../navigation/types'
import type { NativeStackScreenProps } from '@react-navigation/native-stack'

import { EudiWallet, TransferEventType } from 'eudi-wallet-kit-react-native'
import { EudiWallet, TransferEventType } from '@openwallet-foundation/eudi-wallet-kit-react-native'
import React, { useEffect, useState } from 'react'
import { StyleSheet, Text, useWindowDimensions, View, SafeAreaView, Platform } from 'react-native'
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'
Expand Down
2 changes: 1 addition & 1 deletion example/src/screens/Scan.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { NativeStackNavigationProp } from '@react-navigation/native-stack'

import { EudiWallet } from '@openwallet-foundation/eudi-wallet-kit-react-native'
import { useNavigation } from '@react-navigation/native'
import { EudiWallet } from 'eudi-wallet-kit-react-native'
import React, { useCallback, useEffect, useState } from 'react'
import { Alert, Linking, View, StyleSheet, Text } from 'react-native'
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'
Expand Down
31 changes: 7 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eudi-wallet-kit-react-native",
"version": "0.1.0",
"name": "@openwallet-foundation/eudi-wallet-kit-react-native",
"version": "0.1.0-alpha.0",
"description": "React Native wrapper for EUDI wallet reference libraries",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand All @@ -26,7 +26,10 @@
"!**/__tests__",
"!**/__fixtures__",
"!**/__mocks__",
"!**/.*"
"!**/.*",
"package.json",
"README.md",
"LICENSE"
],
"scripts": {
"example:start": "cd ./example && yarn start",
Expand All @@ -46,10 +49,7 @@
"ios",
"android"
],
"repository": {
"type": "git",
"url": "git+https://github.com/openwallet-foundation-labs/eudi-wallet-kit-react-native.git"
},
"repository": "https://github.com/openwallet-foundation-labs/eudi-wallet-kit-react-native.git",
"homepage": "https://github.com/openwallet-foundation-labs/eudi-wallet-kit-react-native",
"author": "Alexander Shenshin <[email protected]> (https://github.com/AlexanderShenshin)",
"dependencies": {
Expand Down Expand Up @@ -106,23 +106,6 @@
"@commitlint/config-conventional"
]
},
"release-it": {
"git": {
"commitMessage": "chore: release ${version}",
"tagName": "v${version}"
},
"npm": {
"publish": true
},
"github": {
"release": true
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": "angular"
}
}
},
"react-native-builder-bob": {
"source": "src",
"output": "lib",
Expand Down
2 changes: 1 addition & 1 deletion src/events/TransferEvent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RequestedDocument } from 'eudi-wallet-kit-react-native'
import type { RequestedDocument } from '@openwallet-foundation/eudi-wallet-kit-react-native'

export enum TransferEventType {
Connecting = 'TransferConnecting',
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"rootDir": ".",
"paths": {
"eudi-wallet-kit-react-native": ["./src/index"]
"@openwallet-foundation/eudi-wallet-kit-react-native": ["./src/index"]
},
"allowUnreachableCode": false,
"allowUnusedLabels": false,
Expand Down
Loading

0 comments on commit 8d61216

Please sign in to comment.