diff --git a/.github/RELEASE_TEMPLATE/release-notes.md b/.github/RELEASE_TEMPLATE/release-notes.md new file mode 100644 index 0000000000..22962bbfb7 --- /dev/null +++ b/.github/RELEASE_TEMPLATE/release-notes.md @@ -0,0 +1,5 @@ +Changes in this stable release +## Changed +## Added +## Fixes +## Breaking diff --git a/.github/workflows/call.check-query-schema-against-subgraph.yml b/.github/workflows/call.check-query-schema-against-subgraph.yml index 0bc100bfa6..14cb68ea02 100644 --- a/.github/workflows/call.check-query-schema-against-subgraph.yml +++ b/.github/workflows/call.check-query-schema-against-subgraph.yml @@ -40,4 +40,4 @@ jobs: ./tasks/testSchemasAndQueries.sh working-directory: ${{ env.sdk-core-working-directory }} env: - SUBGRAPH_RELEASE_TAG: ${{ inputs.subgraph-release }} + SUBGRAPH_RELEASE_TAG: ${{ inputs.subgraph-release }} diff --git a/.github/workflows/cd.ethereum-contracts-stable.create-release-drafts.yml b/.github/workflows/cd.ethereum-contracts-stable.create-release-drafts.yml deleted file mode 100644 index c5fe163e29..0000000000 --- a/.github/workflows/cd.ethereum-contracts-stable.create-release-drafts.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: CD | Create ethereum-contracts Stable Release Draft -env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - -on: - workflow_dispatch: - push: - branches: - - "release-ethereum-contracts-stable" - paths: - - "packages/ethereum-contracts/**" - - ".github/workflows/cd.ethereum-contracts-stable.create-release-drafts.yml" - -jobs: - - create-release-draft: - name: Create Release Draft - - runs-on: ubuntu-latest - - permissions: write-all - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js 18.x - uses: actions/setup-node@v3 - with: - node-version: 18.x - registry-url: https://registry.npmjs.org/ - - - name: Check package versions - id: check_versions - run: | - # ethereum-contracts - PUBLISHED_ETHEREUM_CONTRACTS_VERSION=$(npm show @superfluid-finance/ethereum-contracts@latest version) - NEW_ETHEREUM_CONTRACTS_VERSION=$(jq -r .version packages/ethereum-contracts/package.json) - if [ "$PUBLISHED_ETHEREUM_CONTRACTS_VERSION" != "$NEW_ETHEREUM_CONTRACTS_VERSION" ];then - echo "PUBLISH_ETHEREUM_CONTRACTS=1" >> "$GITHUB_ENV" - echo "ethereum-contracts changed: $PUBLISHED_ETHEREUM_CONTRACTS_VERSION -> $NEW_ETHEREUM_CONTRACTS_VERSION" - else - echo ethereum-contracts unchanged: "$PUBLISHED_ETHEREUM_CONTRACTS_VERSION" - fi - - echo "NEW_ETHEREUM_CONTRACTS_VERSION=$NEW_ETHEREUM_CONTRACTS_VERSION" >> "$GITHUB_OUTPUT" - - - name: Create ethereum-contracts release draft - if: env.PUBLISH_ETHEREUM_CONTRACTS == 1 - id: create_release_ethereum_contracts - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ethereum-contracts@v${{ steps.check_versions.outputs.NEW_ETHEREUM_CONTRACTS_VERSION }} - release_name: ethereum-contracts@v${{ steps.check_versions.outputs.NEW_ETHEREUM_CONTRACTS_VERSION }} - body: | - Changes in this ethereum-contracts stable release - ## Changed - ## Added - ## Fixes - ## Breaking - draft: true diff --git a/.github/workflows/cd.packages-stable.create-release-drafts.yml b/.github/workflows/cd.packages-stable.create-release-drafts.yml new file mode 100644 index 0000000000..f1355547d6 --- /dev/null +++ b/.github/workflows/cd.packages-stable.create-release-drafts.yml @@ -0,0 +1,196 @@ +name: CD | Create Monorepo Packages Stable Release Draft +env: + GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} + +on: + workflow_dispatch: + push: + branches: + - "dev" + paths: + - "packages/ethereum-contracts/**" + - "packages/subgraph/**" + - "packages/metadata/**" + - "packages/sdk-core/**" + - "packages/sdk-redux/**" + - ".github/workflows/cd.packages-stable.create-release-drafts.yml" + +jobs: + create-ethereum-contracts-release-draft: + name: Create Ethereum-Contracts Release Draft + + runs-on: ubuntu-latest + + permissions: write-all + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + registry-url: https://registry.npmjs.org/ + + - name: Check package versions + run: ./tasks/check-package-version.sh ethereum-contracts SHOULD_PUBLISH_ETHEREUM_CONTRACTS ETHEREUM_CONTRACTS_NEW_VERSION >> "$GITHUB_ENV" + + - name: Create ethereum-contracts stable release draft + if: env.SHOULD_PUBLISH_ETHEREUM_CONTRACTS == 1 + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ethereum-contracts@v${{ env.ETHEREUM_CONTRACTS_NEW_VERSION }} + release_name: ethereum-contracts@v${{ env.ETHEREUM_CONTRACTS_NEW_VERSION }} + body_path: .github/RELEASE_TEMPLATE/release-notes.md + draft: true + + create-subgraph-release-draft: + name: Create Subgraph Release Draft + + runs-on: ubuntu-latest + + permissions: write-all + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + registry-url: https://registry.npmjs.org/ + + - name: Check package versions + run: ./tasks/check-package-version.sh subgraph SHOULD_PUBLISH_SUBGRAPH SUBGRAPH_NEW_VERSION >> "$GITHUB_ENV" + + - name: Create subgraph stable release draft + if: env.SHOULD_PUBLISH_SUBGRAPH == 1 + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: subgraph@v${{ env.SUBGRAPH_NEW_VERSION }} + release_name: subgraph@v${{ env.SUBGRAPH_NEW_VERSION }} + body_path: .github/RELEASE_TEMPLATE/release-notes.md + draft: true + + create-and-publish-metadata-package: + name: Create Metadata Release Draft and Publish to NPM + + runs-on: ubuntu-latest + + permissions: write-all + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + registry-url: https://registry.npmjs.org/ + + - name: Check package versions + run: ./tasks/check-package-version.sh metadata SHOULD_PUBLISH_METADATA METADATA_NEW_VERSION >> "$GITHUB_ENV" + + - name: Create metadata stable release draft + if: env.SHOULD_PUBLISH_METADATA == 1 + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: metadata@v${{ env.METADATA_NEW_VERSION }} + release_name: metadata@v${{ env.METADATA_NEW_VERSION }} + body: | + Please refer to the CHANGELOG.md file in metadata package for more details on the changeset. + draft: false + - name: Publish metadata package + if: env.SHOULD_PUBLISH_METADATA == 1 + run: | + yarn --cwd packages/metadata build + tasks/npm-publish.sh packages/metadata/ latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPMJS_TOKEN: ${{ secrets.NPMJS_TOKEN }} + + test-sdk-core-query-schema-against-deployed-v1-subgraphs: + uses: ./.github/workflows/call.check-query-schema-against-subgraph.yml + name: Test SDK-Core Query Schema and Queries Against Deployed V1 Subgraphs + with: + subgraph-release: v1 + + test-sdk-core-with-v1-release-subgraph: + uses: ./.github/workflows/call.test-sdk-core.yml + name: Build and Test SDK-Core (Release branch) + with: + subgraph-release: v1 + subgraph-endpoint: "" + run-coverage-tests: false + + create-sdk-core-release-draft: + name: Create SDK-Core Release Draft + + runs-on: ubuntu-latest + + needs: + [ + test-sdk-core-query-schema-against-deployed-v1-subgraphs, + test-sdk-core-with-v1-release-subgraph, + ] + + permissions: write-all + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + registry-url: https://registry.npmjs.org/ + + - name: Check package versions + run: ./tasks/check-package-version.sh sdk-core SHOULD_PUBLISH_SDK_CORE SDK_CORE_NEW_VERSION >> "$GITHUB_ENV" + + - name: Create sdk-core stable release draft + if: env.SHOULD_PUBLISH_SDK_CORE == 1 + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: sdk-core@v${{ env.SDK_CORE_NEW_VERSION }} + release_name: sdk-core@v${{ env.SDK_CORE_NEW_VERSION }} + body_path: .github/RELEASE_TEMPLATE/release-notes.md + draft: true + + create-sdk-redux-release-draft: + name: Create SDK-Redux Release Draft + + runs-on: ubuntu-latest + + permissions: write-all + + steps: + - uses: actions/checkout@v3 + + - name: Use Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + registry-url: https://registry.npmjs.org/ + + - name: Check package versions + run: ./tasks/check-package-version.sh sdk-redux SHOULD_PUBLISH_SDK_REDUX SDK_REDUX_NEW_VERSION >> "$GITHUB_ENV" + + - name: Create sdk-redux stable release draft + if: env.SHOULD_PUBLISH_SDK_REDUX == 1 + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: sdk-redux@v${{ env.SDK_REDUX_NEW_VERSION }} + release_name: sdk-redux@v${{ env.SDK_REDUX_NEW_VERSION }} + body_path: .github/RELEASE_TEMPLATE/release-notes.md + draft: true diff --git a/.github/workflows/cd.sdk-core-stable.create-release-drafts.yml b/.github/workflows/cd.sdk-core-stable.create-release-drafts.yml deleted file mode 100644 index 3fb8d5304d..0000000000 --- a/.github/workflows/cd.sdk-core-stable.create-release-drafts.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: CD | Create SDK-Core Stable Release Draft -env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - -on: - workflow_dispatch: - push: - branches: - - "release-sdk-core-stable" - paths: - - "packages/sdk-core/**" - - ".github/workflows/cd.sdk-core-stable.create-release-drafts.yml" - -jobs: - - test-sdk-core-query-schema-against-deployed-v1-subgraphs: - uses: ./.github/workflows/call.check-query-schema-against-subgraph.yml - name: Test SDK-Core Query Schema and Queries Against Deployed V1 Subgraphs - with: - subgraph-release: v1 - - test-sdk-core-with-v1-release-subgraph: - uses: ./.github/workflows/call.test-sdk-core.yml - name: Build and Test SDK-Core (Release branch) - with: - subgraph-release: v1 - subgraph-endpoint: '' - run-coverage-tests: false - - create-release-draft: - name: Create Release Draft - - runs-on: ubuntu-latest - - needs: [ test-sdk-core-query-schema-against-deployed-v1-subgraphs - , test-sdk-core-with-v1-release-subgraph - ] - - permissions: write-all - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js 18.x - uses: actions/setup-node@v3 - with: - node-version: 18.x - registry-url: https://registry.npmjs.org/ - - - name: Check package versions - id: check_versions - run: | - # sdk-core - PUBLISHED_SDK_CORE_VERSION=$(npm show @superfluid-finance/sdk-core@latest version) - NEW_SDK_CORE_VERSION=$(jq -r .version packages/sdk-core/package.json) - if [ "$PUBLISHED_SDK_CORE_VERSION" != "$NEW_SDK_CORE_VERSION" ];then - echo "PUBLISHED_SDK_CORE_VERSION=1" >> "$GITHUB_ENV" - echo "sdk-core changed: $PUBLISHED_SDK_CORE_VERSION -> $NEW_SDK_CORE_VERSION" - else - echo sdk-core unchanged: "$PUBLISHED_SDK_CORE_VERSION" - fi - - echo "NEW_SDK_CORE_VERSION=$NEW_SDK_CORE_VERSION" >> "$GITHUB_OUTPUT" - - - name: Create sdk-core stable release draft - if: env.PUBLISHED_SDK_CORE_VERSION == 1 - id: create_release_sdk_core - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: sdk-core@v${{ steps.check_versions.outputs.NEW_SDK_CORE_VERSION }} - release_name: sdk-core@v${{ steps.check_versions.outputs.NEW_SDK_CORE_VERSION }} - body: | - Changes in this sdk-core stable release - ## Changed - ## Added - ## Fixes - ## Breaking - draft: true diff --git a/.github/workflows/cd.sdk-redux-stable.create-release-drafts.yml b/.github/workflows/cd.sdk-redux-stable.create-release-drafts.yml deleted file mode 100644 index a2217dea08..0000000000 --- a/.github/workflows/cd.sdk-redux-stable.create-release-drafts.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: CD | Create SDK-Redux Stable Release Draft -env: - GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - -on: - workflow_dispatch: - push: - branches: - - "release-sdk-redux-stable" - paths: - - "packages/sdk-redux/**" - - ".github/workflows/cd.sdk-redux-stable.create-release-drafts.yml" - -jobs: - - create-release-draft: - name: Create Release Draft - - runs-on: ubuntu-latest - - permissions: write-all - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js 18.x - uses: actions/setup-node@v3 - with: - node-version: 18.x - registry-url: https://registry.npmjs.org/ - - - name: Check package versions - id: check_versions - run: | - # sdk-redux - PUBLISHED_SDK_REDUX_VERSION=$(npm show @superfluid-finance/sdk-redux@latest version) - NEW_SDK_REDUX_VERSION=$(jq -r .version packages/sdk-redux/package.json) - if [ "$PUBLISHED_SDK_REDUX_VERSION" != "$NEW_SDK_REDUX_VERSION" ];then - echo "PUBLISHED_SDK_REDUX_VERSION=1" >> "$GITHUB_ENV" - echo "sdk-redux changed: $PUBLISHED_SDK_REDUX_VERSION -> $NEW_SDK_REDUX_VERSION" - else - echo sdk-redux unchanged: "$PUBLISHED_SDK_REDUX_VERSION" - fi - - echo "NEW_SDK_REDUX_VERSION=$NEW_SDK_REDUX_VERSION" >> "$GITHUB_OUTPUT" - - - name: Create sdk-redux stable release draft - if: env.PUBLISHED_SDK_REDUX_VERSION == 1 - id: create_release_sdk_redux - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: sdk-redux@v${{ steps.check_versions.outputs.NEW_SDK_REDUX_VERSION }} - release_name: sdk-redux@v${{ steps.check_versions.outputs.NEW_SDK_REDUX_VERSION }} - body: | - Changes in this sdk-redux stable release - ## Changed - ## Added - ## Fixes - ## Breaking - draft: true diff --git a/.github/workflows/cd.subgraph-stable.create-release-drafts.yml b/.github/workflows/cd.subgraph-stable.create-release-drafts.yml deleted file mode 100644 index 251ef025ce..0000000000 --- a/.github/workflows/cd.subgraph-stable.create-release-drafts.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: CD | Create Subgraph Stable Release Draft - -on: - workflow_dispatch: - push: - branches: - - "release-subgraph-v1" - paths: - - "packages/subgraph/**" - - ".github/workflows/cd.subgraph-stable.create-release-drafts.yml" - -jobs: - - create-release-draft: - name: Create Release Draft - - runs-on: ubuntu-latest - - permissions: write-all - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js 18.x - uses: actions/setup-node@v3 - with: - node-version: 18.x - registry-url: https://registry.npmjs.org/ - - - name: Check package versions - id: check_versions - run: | - # subgraph - NEW_SUBGRAPH_VERSION=$(jq -r .version packages/subgraph/package.json) - if git tag | grep -e "^subgraph" | grep v"$NEW_SUBGRAPH_VERSION";then - echo subgraph version exists - else - echo "PUBLISHED_SUBGRAPH_VERSION=1" >> "$GITHUB_ENV" - echo "subgraph changed: $NEW_SUBGRAPH_VERSION" - fi - - echo "NEW_SUBGRAPH_VERSION=$NEW_SUBGRAPH_VERSION" >> "$GITHUB_OUTPUT" - - - name: Create subgraph stable release draft - if: env.PUBLISHED_SUBGRAPH_VERSION == 1 - id: create_release_SUBGRAPH - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: subgraph@v${{ steps.check_versions.outputs.NEW_SUBGRAPH_VERSION }} - release_name: subgraph@v${{ steps.check_versions.outputs.NEW_SUBGRAPH_VERSION }} - body: | - Changes in this subgraph stable release - ## Changed - ## Added - ## Fixes - ## Breaking - draft: true diff --git a/README.md b/README.md index 24dc950e97..8cff7b072d 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,19 @@ EVM contracts implementation for the Superfluid Protocol. If you're interest in peeking under the hood, then check out the contracts package. +#### [`@superfluid-finance/metadata`](https://github.com/superfluid-finance/protocol-monorepo/tree/dev/packages/metadata) + +

+ + Version + + + License: MIT + +

+ +Contract addresses, subgraph URLs, and other metadata for the Superfluid Protocol. + #### [`@superfluid-finance/sdk-core`](https://github.com/superfluid-finance/protocol-monorepo/tree/dev/packages/sdk-core)

diff --git a/packages/metadata/LICENSE b/packages/metadata/LICENSE new file mode 100644 index 0000000000..aa13c7d0e1 --- /dev/null +++ b/packages/metadata/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright © 2020-2023 Superfluid Finance Ltd + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tasks/check-package-version.sh b/tasks/check-package-version.sh new file mode 100755 index 0000000000..0807355efb --- /dev/null +++ b/tasks/check-package-version.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# This script checks if the package version has changed since the last release. +# Usage: check-package-version.sh [package_name] [do_publish_var_name] [new_version_var_name] +# +# It will print these to standard output: +# ${do_publish_var_name}=0|1 +# ${new_version_var_name}=x.y.z # only when ${do_publish_var_name}=1 + +package_name=$1 +do_publish_var_name=$2 +new_version_var_name=$3 +if ! published_version=$(npm show @superfluid-finance/"$package_name"@latest version); then + echo "Querying current published version failed." >&2 + exit 1 +fi +new_version=$(jq -r .version packages/"$package_name"/package.json) + +if [ "$published_version" != "$new_version" ]; then + echo "$package_name changed: $published_version -> $new_version" >&2 + echo "$do_publish_var_name=1" + echo "$new_version_var_name=$new_version" +else + echo "$package_name unchanged: $published_version" >&2 + echo "$do_publish_var_name=0" +fi