Skip to content

Commit

Permalink
feat: add release flow to wallet package (FuelLabs#185)
Browse files Browse the repository at this point in the history
Fix FuelLabs#184 

## Tasks

- [x] Add changeset
- [x] Configure Github actions to release
- [x] Change package's name fo use `@fuel-wallet/*` instead of
`@fuels-wallet/*`

Co-authored-by: luizstacio <[email protected]>
Co-authored-by: Luiz Felipe Bolsoni Gomes <[email protected]>
  • Loading branch information
3 people authored Nov 10, 2022
1 parent a0ba38f commit 987bbb0
Show file tree
Hide file tree
Showing 63 changed files with 804 additions and 92 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
24 changes: 24 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "FuelLabs/fuels-wallet" }
],
"commit": false,
"fixed": [["@fuel-wallet/*"]],
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": [
"app",
"page",
"@fuel-wallet/config",
"fuelhat",
"@fuel-wallet/xstore"
],
"snapshot": {
"useCalculatedVersion": true,
"prereleaseTemplate": "{tag}-{commit}"
}
}
6 changes: 6 additions & 0 deletions .changeset/fluffy-pandas-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@fuel-wallet/sdk": minor
"@fuel-wallet/types": minor
---

Feat: initial package release for all packages
16 changes: 16 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

validate-changeset:
name: Validate PR Changeset
if: github.head_ref != 'changeset-release/master'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

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

- name: Validate Changeset
run: pnpm changeset status --since=origin/master

audit:
name: Audit
runs-on: ubuntu-latest
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: "Release"

on:
push:
branches:
- master

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

jobs:
release-changesets:
name: Changesets Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# need this to get full git-history/clone in order to build changelogs and check changesets
fetch-depth: 0

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

- name: Configure npm
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Bump and Collect Version
run: |
pnpm changeset version
echo "BUILD_VERSION=$(sed -nE 's/^\s*"version": "(.*?)",$/\1/p' design-system/react/package.json)" >> $GITHUB_ENV
git reset --hard
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Ensure NPM access
run: npm whoami
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Setup git user (for changelog step)
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Build
run: pnpm build:libs

- name: Create Release Pull Request or Publish to NPM
id: changesets
uses: FuelLabs/changesets-action@main
with:
publish: pnpm changeset:release
commit: "ci(changesets): versioning packages"
title: "ci(changesets): versioning packages"
createGithubReleases: aggregate
githubReleaseName: v${{ env.BUILD_VERSION }}
githubTagName: v${{ env.BUILD_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Release to @next tag
if: steps.changesets.outputs.published != 'true'
run: |
git checkout master
pnpm changeset version --snapshot next
pnpm changeset publish --tag next
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 1 addition & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.changeset
.coverage_*
.github
CHANGELOG.md
Expand All @@ -7,4 +6,4 @@ dist
dist-crx
node_modules
pnpm-lock.yaml
**/*.typegen.ts
**/*.typegen.ts
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ Integrate your **DApp** using the [Wallet SDK](./docs/WALLET_SDK.md)

- [x] Create a brand new and secure account
- [x] Recover an account using a passphrase
- [ ] Update account details
- [x] DApps integration
- [x] Request connection
- [x] List accounts
- [x] Sign messages
- [ ] Send transactions
- [x] Check your asset's balance
- [x] Manage networks
- [x] Faucet for testnet
- [ ] Receive screen with QR Code
- [ ] Update account details
- [ ] Reveal your passphrase
- [ ] Change password
- [ ] Faucet for testnet
- [ ] See a list of your recent activities
- [ ] View transaction details
- [ ] Send assets to another wallet
- [ ] Receive screen with QR Code
- [x] DApps integration
- [x] Request connection
- [x] List accounts
- [x] Sign messages
- [ ] Send transactions

## 📜 License

Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@
"./packages/*"
],
"scripts": {
"build:libs": "turbo run build --filter=@fuels-wallet/* --no-cache",
"build:libs": "turbo run build --filter=@fuel-wallet/* --no-cache",
"build:preview": "./scripts/build-preview.sh",
"build": "pnpm build:libs && turbo run build",
"build:crx": "pnpm build:libs && turbo run build:crx",
"build:all": "run-s build build:crx",
"changeset": "changeset",
"changeset:release": "changeset publish --no-git-tag",
"changeset:version": "changeset version",
"changeset:check": "changeset status --since=master",
"deps:update": "updates -gu && pnpm -r exec updates -gu",
"dev": "turbo run dev --parallel",
"dev:crx": "turbo run dev:crx --parallel",
Expand All @@ -51,6 +55,7 @@
},
"devDependencies": {
"@babel/core": "^7.19.6",
"@changesets/cli": "^2.25.2",
"@jest/types": "29.2.1",
"@playwright/test": "^1.27.1",
"@types/jest": "^29.2.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"@fuel-ui/css": "^0.9.0",
"@fuel-ui/react": "^0.9.0",
"@fuel-ui/test-utils": "^0.9.0",
"@fuels-wallet/sdk": "workspace:*",
"@fuels-wallet/types": "workspace:*",
"@fuels-wallet/xstore": "workspace:*",
"@fuel-wallet/sdk": "workspace:*",
"@fuel-wallet/types": "workspace:*",
"@fuel-wallet/xstore": "workspace:*",
"@hookform/resolvers": "^2.9.10",
"@react-aria/utils": "^3.14.0",
"@xstate/react": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/store.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createStore } from '@fuels-wallet/xstore';
import { createStore } from '@fuel-wallet/xstore';

import { accountEvents } from './systems/Account/events';
import { networkEvents } from './systems/Network/events';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
IconButton,
Text,
} from '@fuel-ui/react';
import type { Account } from '@fuels-wallet/types';
import type { Account } from '@fuel-wallet/types';

import { shortAddress } from '~/systems/Core';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Button, CardList, Stack } from '@fuel-ui/react';
import type { Account } from '@fuels-wallet/types';
import type { Account } from '@fuel-wallet/types';
import { useState } from 'react';

import { AccountItem } from '../AccountItem';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
IconButton,
Text,
} from '@fuel-ui/react';
import type { Account } from '@fuels-wallet/types';
import type { Account } from '@fuel-wallet/types';
import { useEffect, useState } from 'react';
import type { ReactNode } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/systems/Account/events.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { StoreClass } from '@fuels-wallet/xstore';
import type { StoreClass } from '@fuel-wallet/xstore';

import type { StoreMachines } from '~/store';
import { Services } from '~/store';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Account } from '@fuels-wallet/types';
import type { Account } from '@fuel-wallet/types';
import type { InterpreterFrom, StateFrom } from 'xstate';
import { assign, createMachine } from 'xstate';

Expand Down
6 changes: 3 additions & 3 deletions packages/app/src/systems/Account/services/account.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable consistent-return */
import { WalletManager } from '@fuel-ts/wallet-manager';
import type { Account } from '@fuels-wallet/types';
import type { Account } from '@fuel-wallet/types';
import { bn, Address, Provider } from 'fuels';

import { IndexedDBStorage } from '../utils';
Expand Down Expand Up @@ -120,7 +120,7 @@ export class AccountService {
await db.vaults.clear();

/**
* TODO: this is needed because of a typing error with StorageAbstract from fuels-ts
* TODO: this is needed because of a typing error with StorageAbstract from fuel-ts
*/
const storage = new IndexedDBStorage() as never;
const manager = new WalletManager({ storage });
Expand All @@ -146,7 +146,7 @@ export class AccountService {
const wallet = manager.getWallet(
Address.fromPublicKey(input.account.publicKey)
);
// TODO: fix this on fuels-ts it should be possible to
// TODO: fix this on fuel-ts it should be possible to
// customize the ProviderURL on the manager level
wallet.provider = new Provider(VITE_FUEL_PROVIDER_URL);
return wallet;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cssObj } from '@fuel-ui/css';
import { Avatar, CardList, Flex, Heading, Text } from '@fuel-ui/react';
import type { Coin } from '@fuels-wallet/types';
import type { Coin } from '@fuel-wallet/types';
import type { FC } from 'react';

import { getAssetInfoById } from '../../utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CardList } from '@fuel-ui/react';
import type { Coin } from '@fuels-wallet/types';
import type { Coin } from '@fuel-wallet/types';
import type { FC } from 'react';

import { AssetItem } from '../AssetItem';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cssObj } from '@fuel-ui/css';
import { Avatar, Card, Copyable, Flex, Grid, Text } from '@fuel-ui/react';
import type { Coin } from '@fuels-wallet/types';
import type { Coin } from '@fuel-wallet/types';
import { bn } from 'fuels';

import { getAssetInfoById } from '../../utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/systems/Asset/utils/asset.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Coin, AssetAmount } from '@fuels-wallet/types';
import type { Coin, AssetAmount } from '@fuel-wallet/types';
import type { BytesLike } from 'fuels';

import { ASSET_LIST, ASSET_MAP } from './constants';
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/systems/Asset/utils/constants.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Asset } from '@fuels-wallet/types';
import type { Asset } from '@fuel-wallet/types';

import { relativeUrl } from '~/systems/Core';

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/systems/CRX/background/communication.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BACKGROUND_SCRIPT_NAME } from '@fuels-wallet/sdk';
import { BACKGROUND_SCRIPT_NAME } from '@fuel-wallet/sdk';

import { BackgroundService } from './services/BackgroundService';
import { CommunicationProtocol } from './services/CommunicationProtocol';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { CONTENT_SCRIPT_NAME, MessageTypes } from '@fuels-wallet/sdk';
import { CONTENT_SCRIPT_NAME, MessageTypes } from '@fuel-wallet/sdk';
import type { JSONRPCParams } from 'json-rpc-2.0';
import { JSONRPCServer } from 'json-rpc-2.0';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import type {
CommunicationEventArg,
CommunicationMessage,
EventMessage,
} from '@fuels-wallet/sdk';
} from '@fuel-wallet/sdk';
import {
BACKGROUND_SCRIPT_NAME,
BaseConnection,
createUUID,
MessageTypes,
} from '@fuels-wallet/sdk';
} from '@fuel-wallet/sdk';

export class CommunicationProtocol extends BaseConnection {
ports: Map<string, chrome.runtime.Port>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CONTENT_SCRIPT_NAME, MessageTypes } from '@fuels-wallet/sdk';
import { CONTENT_SCRIPT_NAME, MessageTypes } from '@fuel-wallet/sdk';

import type { CommunicationProtocol } from './CommunicationProtocol';
import { DatabaseObservable } from './DatabaseObservable';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
DatabaseEventArg,
DatabaseObservableEvent,
} from '@fuels-wallet/sdk';
} from '@fuel-wallet/sdk';
import EventEmitter from 'events';

import { db } from '~/systems/Core/utils/database';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ResponseMessage, UIEventMessage } from '@fuels-wallet/sdk';
import { POPUP_SCRIPT_NAME, MessageTypes } from '@fuels-wallet/sdk';
import type { ResponseMessage, UIEventMessage } from '@fuel-wallet/sdk';
import { POPUP_SCRIPT_NAME, MessageTypes } from '@fuel-wallet/sdk';
import { JSONRPCClient } from 'json-rpc-2.0';

import {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/systems/CRX/scripts/contentScript.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ContentProxyConnection } from '@fuels-wallet/sdk';
import { ContentProxyConnection } from '@fuel-wallet/sdk';

import fileName from './pageScript?script&module';

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/systems/CRX/scripts/pageScript.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { injectFuelWeb3 } from '@fuels-wallet/sdk';
import { injectFuelWeb3 } from '@fuel-wallet/sdk';

injectFuelWeb3(window);
2 changes: 1 addition & 1 deletion packages/app/src/systems/Core/utils/database.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Account, Vault, Connection, Network } from '@fuels-wallet/types';
import type { Account, Vault, Connection, Network } from '@fuel-wallet/types';
import type { Table } from 'dexie';
import Dexie from 'dexie';

Expand Down
Loading

0 comments on commit 987bbb0

Please sign in to comment.