diff --git a/.github/workflows/release_registry.yml b/.github/workflows/release_registry.yml new file mode 100644 index 0000000..8299aaa --- /dev/null +++ b/.github/workflows/release_registry.yml @@ -0,0 +1,55 @@ +name: Merge Source Configs and Create Release + +on: + push: + branches: + - main + paths: + - '**.yml' + pull_request: + types: + - closed + +jobs: + merge_yaml: + runs-on: ubuntu-latest + + steps: + - name: Check out the code + uses: actions/checkout@v2 + + - name: Merge Source Configs + run: python merge_configs.py + working-directory: ${{ github.workspace }} + + - name: Get next version + uses: reecetech/version-increment@2023.9.3 + id: version + with: + scheme: semver + increment: patch + + - name: Create a new Release + if: github.event.pull_request.merged == true || github.event.ref == 'refs/heads/main' + run: | + release_version=${{ steps.version.outputs.version }} + release_name="v$release_version" + release_body="An updated version of the KYVE Source-Registry." + release_url="https://api.github.com/repos/${GITHUB_REPOSITORY}/releases" + + # Create a release using the GitHub API + response=$(curl -X POST "$release_url" \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -d '{ + "tag_name": "'"$release_version"'", + "name": "'"$release_name"'", + "body": "'"$release_body"'" + }') + + # Upload the merged YAML file as an asset + upload_url=$(echo "$response" | jq -r .upload_url) + upload_url=${upload_url/\{?name,label\}/} + curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary "@registry.yml" \ + "$upload_url?name=registry.yml" \ No newline at end of file diff --git a/README.md b/README.md index 2dce703..504dcbf 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # KYVE - Source Registry -The **Source Registry** serves as the reference for all launched pools on the KYVE Network, covering both the Mainnet `kyve-1` and Testnet `kaon-1`. It provides comprehensive information about the launched pools of a specific chain, with a primary focus on listing the essential `block_source_id` and `state_source_id`. Whether you are a KYVE Network participant or developer, this repository is your go-to resource for staying informed about the network's pool configurations and statuses. +The **Source Registry** serves as the reference for all launched pools on the KYVE Network, covering both the Mainnet `kyve-1` and Testnet `kaon-1`. It provides comprehensive information about the launched sources of a specific chain, with a primary focus on listing the essential `block_source_id` and `state_source_id`. Whether you are a KYVE Network participant or developer, this repository is your go-to resource for staying informed about the network's pool configurations and statuses. diff --git a/merge_configs.py b/merge_configs.py new file mode 100644 index 0000000..7e323b6 --- /dev/null +++ b/merge_configs.py @@ -0,0 +1,17 @@ +import os +import yaml + +merged_config = {} + +# Iterate through all config.yml files +for root, dirs, files in os.walk("."): + for file in files: + if file == "config.yml": + chain_id = os.path.basename(root) + with open(os.path.join(root, file), 'r') as stream: + config = yaml.safe_load(stream) + merged_config[chain_id] = config + +# Write the merged config to a new file +with open("registry.yml", "w") as output_file: + yaml.dump(merged_config, output_file)