Skip to content

Merge pull request #4 from KYVENetwork/source/dydx #12

Merge pull request #4 from KYVENetwork/source/dydx

Merge pull request #4 from KYVENetwork/source/dydx #12

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: Get next version
uses: reecetech/[email protected]
id: version
with:
scheme: semver
increment: patch
- name: Merge Source Configs
run: python merge_configs.py --version ${{ steps.version.outputs.version }}
working-directory: ${{ github.workspace }}
- 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"