Skip to content

Commit

Permalink
Merge pull request #44 from babylonchain/merge-dev-into-main-0.2.4
Browse files Browse the repository at this point in the history
Merge dev into main 0.2.4
  • Loading branch information
jrwbabylonlab authored Jun 26, 2024
2 parents d92c12c + 0868ac8 commit 1393f43
Show file tree
Hide file tree
Showing 14 changed files with 977 additions and 132 deletions.
55 changes: 52 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,36 @@ jobs:
command: npm install
- run:
name: Run tests
command: npm run tests

command: npm run test
publish_canary:
machine:
image: ubuntu-2204:2024.01.1
steps:
- checkout
- node/install:
node-version: '21.7'
- run:
name: Install requirements
command: npm install
- run:
name: Authenticate with NPM registry
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
- run:
name: Publish canary package
command: |
npm publish --tag canary
if [ $? -ne 0 ]; then
echo "npm publish failed, stopping the job."
exit 1
fi
validate_main_version:
machine:
image: ubuntu-2204:2024.01.1
steps:
- checkout
- run:
name: Validate version
command: ./bin/ci_validate_version.sh
publish:
machine:
image: ubuntu-2204:2024.01.1
Expand All @@ -35,11 +63,31 @@ jobs:
- run:
name: Publish package
command: npm publish

workflows:
CI:
jobs:
- build_and_test
- require_approval_for_canary:
type: approval
filters:
branches:
only:
- dev
- publish_canary:
requires:
- build_and_test
- require_approval_for_canary
filters:
branches:
only:
- dev
- validate_main_version:
requires:
- build_and_test
filters:
branches:
only:
- main
- require_approval:
type: approval
filters:
Expand All @@ -50,6 +98,7 @@ workflows:
requires:
- build_and_test
- require_approval
- validate_main_version
filters:
tags:
only: /.*/
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm test
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
dist
build
coverage
.circleci
.husky
.next
docs
public
README.md
7 changes: 5 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"useTabs": false
}
"useTabs": false,
"plugins": [
"prettier-plugin-organize-imports"
]
}
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<br/>

## Notice

The library is in an experimental version and should not be used for production
purposes and with real funds.

Expand All @@ -20,6 +20,20 @@ purposes and with real funds.
npm i btc-staking-ts
```

## Version Release

### Stable version

Stable release versions are manually released from the main branch.

### Canary version

A canary version is a pre-release version. Make sure all changes are added and committed before running the command below:

```console
npm run version:canary
```

## Usage

### Define Staking Parameters
Expand Down
14 changes: 14 additions & 0 deletions bin/ci_validate_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Ensure jq is installed
if ! command -v jq &> /dev/null; then
sudo apt-get update
sudo apt-get install -y jq
fi

# Check the version in package.json
version=$(jq -r .version package.json)
if [[ $version == *"canary"* ]]; then
echo "Error: main branch should not contain 'canary' versions in the version field."
exit 1
fi
Loading

0 comments on commit 1393f43

Please sign in to comment.