Skip to content

Commit

Permalink
Merge pull request #314 from ERC725Alliance/develop
Browse files Browse the repository at this point in the history
Update main branch to sync latest docs
  • Loading branch information
CallumGrindle authored Oct 5, 2023
2 parents b3027c6 + 4ab134b commit 89c41e5
Show file tree
Hide file tree
Showing 23 changed files with 189 additions and 193 deletions.
88 changes: 23 additions & 65 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,101 +1,59 @@
# If it detects a version bump on main, it will trigger a release.
# If the workflow is started manually, it will skip the bump detection and attempt to publish.
name: Release and publish
name: Create GitHub release and publish to NPM

on:
workflow_dispatch:
push:
branches:
- 'main'

permissions:
contents: write
pull-requests: write

jobs:
release:
release-please:
name: 📦 Create GitHub release and publish to NPM
runs-on: ubuntu-latest
steps:
- name: Ensure main branch
if: github.ref != 'refs/heads/main'
run: |-
echo "Not running on main - exit"
exit 1

- uses: actions/checkout@v2
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 🔍 Check if version changed
uses: EndBug/version-check@v1
if: github.event_name == 'push'
id: check

- name: 🔄 Check if should release
run: echo "SHOULD_RELEASE=${{ steps.check.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' }}" >> $GITHUB_ENV

- name: ⚙️ Setup Node.js v16
uses: actions/setup-node@v2
if: env.SHOULD_RELEASE == 'true'
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
scope: '@erc725'
cache: 'npm'

- name: 📝 Set Version
if: env.SHOULD_RELEASE == 'true'
run: |-
APP_VERSION="v$(node -pe "require('./package.json').version")"
echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV
- name: 🧰 Install
if: env.SHOULD_RELEASE == 'true'
run: npm ci

- name: 💅 Lint
run: npm run lint

- name: 🎯 Test
if: env.SHOULD_RELEASE == 'true'
run: npm test

- name: 🛠 Build
if: env.SHOULD_RELEASE == 'true'
run: npm run build

# We assume this will be always triggered by a merge from develop
# Therefore we tag the previous commit (the merge commit won't be on develop)
- name: 🏷 Create and push Git Tag
if: env.SHOULD_RELEASE == 'true'
run: |-
git config --global user.email "release@lukso.network"
git config --global user.name "LUKSO Bot"
git tag -a ${{ env.APP_VERSION }} HEAD~ -m "Release Version ${{ env.APP_VERSION }} [CI]"
git push --set-upstream origin tag ${{ env.APP_VERSION }}
# Create GitHub Release
- name: 📝 Extract release notes from CHANGELOG
if: env.SHOULD_RELEASE == 'true'
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
with:
release_notes_file: RELEASENOTES.md

- uses: jwalton/gh-find-current-pr@v1
if: env.SHOULD_RELEASE == 'true'
id: findPR
- uses: google-github-actions/release-please-action@v3
id: release
with:
state: closed
release-type: node
package-name: '@erc725/erc725.js'
bump-minor-pre-major: true
default-branch: main

- name: Add PR body to Release Notes
if: env.SHOULD_RELEASE == 'true'
env:
PR_BODY: ${{ steps.findPR.outputs.body }}
run: |-
echo ${PR_BODY}|cat - RELEASENOTES.md > /tmp/out && mv /tmp/out RELEASENOTES.md
- name: 🔍 Check if version changed
uses: EndBug/version-check@v1
if: github.event_name == 'push'
id: check

- name: 🚀 Create GitHub release
uses: ncipollo/release-action@v1
if: env.SHOULD_RELEASE == 'true'
with:
bodyFile: 'RELEASENOTES.md'
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.APP_VERSION }}
- name: 🔄 Check if should release
run: echo "SHOULD_RELEASE=${{ steps.check.outputs.changed == 'true' }}" >> $GITHUB_ENV

- name: 📦 Publish to NPM
if: env.SHOULD_RELEASE == 'true'
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ If you install it on the backend side, you may need to also install [`isomorphic
import { ERC725 } from '@erc725/erc725.js';
import Web3 from 'web3';

// Part of LSP3-UniversalProfile Schema
// https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-UniversalProfile.md
// Part of LSP3-Profile Schema
// https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-Profile-Metadata.md
const schema = [
{
name: 'SupportedStandards:LSP3UniversalProfile',
key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38',
name: 'SupportedStandards:LSP3Profile',
key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347',
keyType: 'Mapping',
valueContent: '0xabe425d6',
valueContent: '0x5ef83ad9',
valueType: 'bytes',
},
{
Expand Down Expand Up @@ -89,9 +89,9 @@ await myErc725.getData();
/**
[
{
name: 'SupportedStandards:LSP3UniversalProfile',
key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38',
value: '0xabe425d6',
name: 'SupportedStandards:LSP3Profile',
key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347',
value: '0x5ef83ad9',
},
{
name: 'LSP1UniversalReceiverDelegate',
Expand Down Expand Up @@ -130,9 +130,9 @@ await myErc725.fetchData();
/**
[
{
name: 'SupportedStandards:LSP3UniversalProfile',
key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38',
value: '0xabe425d6'
name: 'SupportedStandards:LSP3Profile',
key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347',
value: '0x5ef83ad9'
},
{
name: 'LSP3Profile',
Expand Down
79 changes: 41 additions & 38 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,63 @@
# Release Process

Releases are published to NPM when `develop` is merged into `main` AND when the merged code contains a version bump in the `package.json`.
Releases are published to npm using [Release Please](https://github.com/googleapis/release-please).

## Create and publish a new release:
This package automates CHANGELOG generation, version bumps and npm releases by parsing the
git history, looking for [Conventional Commit messages](https://www.conventionalcommits.org/).

### Bump version
When changes and feature PRs are merged from develop to main, `release-please` will open and maintain a release PR with the updated CHANGELOG and new version number. When this PR is merged, a release will be created and the package published to NPM.

You can manually trigger the [Bump version](https://github.com/ERC725Alliance/erc725.js/actions/workflows/bump-version.yml) workflow from the `develop` branch.
1. Merge develop into main.
2. Release Please will create the release PR going to main.
3. Merge the generated release PR.
4. Package will be published to NPM.

To bump locally:
## Conventional Commit prefixes?

1. Checkout to a new release branch from `develop`.
2. Bump version with [standard-version](https://github.com/conventional-changelog/standard-version). To create pre-release or specific versions, see below.
Commits should follow the [Conventional Commit messages standard](https://www.conventionalcommits.org/).

```bash
npm run release
```
3. Push the changes to origin. A git tag is created by the release CI so do **not** push tags here.

```bash
git push origin
```
The following commit prefixes will result in changes in the CHANGELOG:

4. Open a PR from your release branch to `develop` and merge it.
- `fix:` which represents bug fixes, and correlates to a [SemVer](https://semver.org/)
patch.
- `feat:` which represents a new feature, and correlates to a minor version increase.
(indicated by the `!`) and will result in a SemVer major version increase.
- `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking change
- `build:` Changes that affect the build system or external dependencies.
- `ci:` Changes to our CI configuration files and scripts.
- `docs:` Documentation only changes.
- `perf:` A code change that improves performance.
- `refactor:` A code change that neither fixes a bug nor adds a feature.
- `style:` Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc).
- `test:` Adding missing tests or correcting existing tests.
- `chore:` Other

### Release
## Release with a custom version number

- Merge `develop` into `main` through a PR.
- The CI will create a GitHub release and publish to NPM.
When a commit to the main branch has `Release-As: x.x.x` (case insensitive) in the **commit body**, Release Please will open a new pull request for the specified version.

If it fails, you can manually trigger the workflow from the [Actions](https://github.com/ERC725Alliance/erc725.js/actions/workflows/release.yml) tab.
`git commit --allow-empty -m "chore: release 2.0.0" -m "Release-As: 2.0.0"` results in the following commit message:

## Specific Version Increases
```txt
chore: release 2.0.0
To ignore the automatic version increase in favour of a custom version use the `--release-as` flag with the argument `major`, `minor` or `patch` or a specific version number:

```bash
npm run release -- --release-as minor
# Or
npm run release -- --release-as 1.1.0
Release-As: 2.0.0
```

## Prerelease versions
## How can I fix release notes?

To create a pre-release run:
If you have merged a pull request and would like to amend the commit message
used to generate the release notes for that commit, you can edit the body of
the merged pull requests and add a section like:

```bash
npm run release -- --prerelease
```
BEGIN_COMMIT_OVERRIDE
feat: add ability to override merged commit message
If the lastest version is 1.0.0, the pre-release command will change the version to: `1.0.1-0`

To name the pre-release, set the name by adding `--prerelease <name>`

```bash
npm run release -- --prerelease alpha
fix: another message
chore: a third message
END_COMMIT_OVERRIDE
```

If the latest version is 1.0.0 this will change the version to: `1.0.1-alpha.0`
The next time Release Please runs, it will use that override section as the
commit message instead of the merged commit message.
23 changes: 12 additions & 11 deletions docs/classes/ERC725.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ myErc725.checkPermissions(requiredPermissions, grantedPermissions);
```

---

## decodeData

```js
Expand Down Expand Up @@ -643,8 +644,8 @@ The hash must be retrievable from the ERC725Y contract via the [getData](#getdat
ERC725.encodeKeyName('LSP3Profile');
// '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5'

ERC725.encodeKeyName('SupportedStandards:LSP3UniversalProfile');
// '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38'
ERC725.encodeKeyName('SupportedStandards:LSP3Profile');
// '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347'

ERC725.encodeKeyName(
'AddressPermissions:Permissions:cafecafecafecafecafecafecafecafecafecafe',
Expand Down Expand Up @@ -883,9 +884,9 @@ await myErc725.fetchData();
/**
[
{
name: 'SupportedStandards:LSP3UniversalProfile',
key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38',
value: '0xabe425d6'
name: 'SupportedStandards:LSP3Profile',
key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347',
value: '0x5ef83ad9'
},
{
name: 'LSP3Profile',
Expand Down Expand Up @@ -1032,9 +1033,9 @@ await myErc725.getData();
/**
[
{
name: 'SupportedStandards:LSP3UniversalProfile',
key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38',
value: '0xabe425d6',
name: 'SupportedStandards:LSP3Profile',
key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347',
value: '0x5ef83ad9',
},
{
name: 'LSP1UniversalReceiverDelegate',
Expand Down Expand Up @@ -1459,7 +1460,7 @@ myErc725.supportsInterface('0xfd4d5c50');

ERC725.supportsInterface('0xfd4d5c50', {
address: '0xe408BDDbBAB1985006A2c481700DD473F932e5cB',
rpcUrl: 'https://rpc.l16.lukso.network',
rpcUrl: 'https://rpc.testnet.lukso.network',
});
// false
```
Expand All @@ -1469,8 +1470,8 @@ myErc725.supportsInterface('LSP0ERC725Account');
// false

ERC725.supportsInterface('LSP0ERC725Account', {
address: '0xe408BDDbBAB1985006A2c481700DD473F932e5cB',
rpcUrl: 'https://rpc.l16.lukso.network',
address: '0x0Dc07C77985fE31996Ed612F568eb441afe5768D',
rpcUrl: 'https://rpc.testnet.lukso.network',
});
// true
```
21 changes: 9 additions & 12 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ import Web3 from 'web3';
// https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-UniversalProfile.md
const schemas = [
{
name: 'SupportedStandards:LSP3UniversalProfile',
key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38',
name: 'SupportedStandards:LSP3Profile',
key: '0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347',
keyType: 'Mapping',
valueType: 'bytes',
valueContent: '0xabe425d6',
valueContent: '0x5ef83ad9',
},
{
name: 'LSP3Profile',
Expand All @@ -57,8 +57,8 @@ const schemas = [
},
];

const address = '0x0c03fba782b07bcf810deb3b7f0595024a444f4e';
const RPC_URL = 'https://rpc.l16.lukso.network';
const address = '0x0Dc07C77985fE31996Ed612F568eb441afe5768D';
const RPC_URL = 'https://rpc.testnet.lukso.network';
const config = {
ipfsGateway: 'https://YOUR-IPFS-GATEWAY/ipfs/',
};
Expand All @@ -72,25 +72,22 @@ const erc725 = new ERC725(schemas, address, RPC_URL, config);
await erc725.getOwner();
// > '0x28D25E70819140daF65b724158D00c373D1a18ee'

await erc725.getData('SupportedStandards:LSP3UniversalProfile');
await erc725.getData('SupportedStandards:LSP3Profile');
/**
{
'SupportedStandards:LSP3UniversalProfile': '0xabe425d6'
'SupportedStandards:LSP3Profile': '0x5ef83ad9'
}
*/

await erc725.getData([
'LSP3Profile',
'SupportedStandards:LSP3UniversalProfile',
]);
await erc725.getData(['LSP3Profile', 'SupportedStandards:LSP3Profile']);
/**
{
LSP3Profile: {
url: 'ipfs://QmXybv2LdJWscy1C6yRKUjvnaj6aqKktZX4g4xmz2nyYj2',
hash: '0xb4f9d72e83bbe7e250ed9ec80332c493b7b3d73e0d72f7b2c7ab01c39216eb1a',
hashFunction: 'keccak256(utf8)'
},
'SupportedStandards:LSP3UniversalProfile': '0xabe425d6'
'SupportedStandards:LSP3Profile': '0x5ef83ad9'
}
*/

Expand Down
Loading

0 comments on commit 89c41e5

Please sign in to comment.