From 22745b0b9917e3931b14415502745e4d93531b83 Mon Sep 17 00:00:00 2001 From: Tristen Harr Date: Tue, 13 Aug 2024 11:58:27 -0500 Subject: [PATCH] update workflow --- .github/workflows/docker.yml | 80 ++++++++++++-------- CHANGELOG.md | 3 + connector-definition/connector-metadata.yaml | 4 +- package-lock.json | 4 +- package.json | 2 +- 5 files changed, 55 insertions(+), 38 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 66a3ac4..42bb312 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -120,6 +120,7 @@ jobs: - name: Update ndc-hub env: + REGISTRY_NAME: hasura CONNECTOR_NAME: qdrant COMMIT_HASH: ${{ needs.build-and-push-image.outputs.commit_hash }} SHA256: ${{ needs.build-and-push-image.outputs.sha256 }} @@ -128,50 +129,63 @@ jobs: # Clone ndc-hub repository git clone https://github.com/hasura/ndc-hub.git cd ndc-hub - + # Create a new branch NEW_BRANCH="update-${{ env.CONNECTOR_NAME }}-connector-v${{ steps.get-version.outputs.tagged_version }}" git checkout -b $NEW_BRANCH - - cd registry/${{ env.CONNECTOR_NAME }} - - # Update metadata.json - jq --arg version "${{ steps.get-version.outputs.tagged_version }}" \ - --arg version_tag "v${{ steps.get-version.outputs.tagged_version }}" \ - --arg uri "https://github.com/${{ github.repository }}/releases/download/v${{ steps.get-version.outputs.tagged_version }}/connector-definition.tgz" \ - --arg checksum "$SHA256" \ + + cd registry/${{ env.REGISTRY_NAME }}/${{ env.CONNECTOR_NAME }} + + # Create releases directory if it doesn't exist + mkdir -p releases/v${{ steps.get-version.outputs.tagged_version }} + + # Create connector-packaging.json + cat << EOF > releases/v${{ steps.get-version.outputs.tagged_version }}/connector-packaging.json + { + "version": "${{ steps.get-version.outputs.tagged_version }}", + "uri": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.get-version.outputs.tagged_version }}/connector-definition.tgz", + "checksum": { + "type": "sha256", + "value": "$SHA256" + }, + "source": { + "hash": "$COMMIT_HASH" + } + } + EOF + + # Update metadata.json to remove 'packages' field if it exists and update 'latest_version' + jq --arg version_tag "v${{ steps.get-version.outputs.tagged_version }}" \ --arg commit_hash "$COMMIT_HASH" \ - '.overview.latest_version = $version_tag | - .packages += [{ - "version": $version, - "uri": $uri, - "checksum": { - "type": "sha256", - "value": $checksum - }, - "source": { - "hash": $commit_hash - } - }] | - .source_code.version += [{ - "tag": $version_tag, - "hash": $commit_hash, - "is_verified": false - }]' \ + 'if has("packages") then del(.packages) else . end | + .overview.latest_version = $version_tag | + if has("source_code") then + .source_code.version += [{ + "tag": $version_tag, + "hash": $commit_hash, + "is_verified": false + }] + else + . + {"source_code": {"version": [{ + "tag": $version_tag, + "hash": $commit_hash, + "is_verified": false + }]}} + end' \ metadata.json > tmp.json && mv tmp.json metadata.json - - cp ../../../README.md ./README.md - + + cp ../../../../README.md ./README.md + # Commit changes git config user.name "GitHub Action" git config user.email "action@github.com" - git add metadata.json README.md + git add metadata.json README.md releases git commit -m "Update ${{ env.CONNECTOR_NAME }} connector metadata to version ${{ steps.get-version.outputs.tagged_version }}" - + # Push changes git push https://${{ secrets.PAT_TOKEN }}@github.com/hasura/ndc-hub.git HEAD:update-${{ env.CONNECTOR_NAME }}-connector-v${{ steps.get-version.outputs.tagged_version }} - - + + # Create PR using GitHub CLI cd ../.. gh pr create --repo hasura/ndc-hub \ diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ebfde7..04e14db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Qdrant Connector Changelog This changelog documents changes between release tags. +## [0.2.6] - 2024-08-13 +* Fix workflow to publish to NDC-hub + ## [0.2.5] - 2024-08-08 * Update SDK to v6.0.0 diff --git a/connector-definition/connector-metadata.yaml b/connector-definition/connector-metadata.yaml index 97939b7..7a13492 100644 --- a/connector-definition/connector-metadata.yaml +++ b/connector-definition/connector-metadata.yaml @@ -1,6 +1,6 @@ packagingDefinition: type: PrebuiltDockerImage - dockerImage: ghcr.io/hasura/ndc-qdrant:v0.2.5 + dockerImage: ghcr.io/hasura/ndc-qdrant:v0.2.6 supportedEnvironmentVariables: - name: QDRANT_URL description: The url for the Qdrant database @@ -9,7 +9,7 @@ supportedEnvironmentVariables: commands: update: type: Dockerized - dockerImage: ghcr.io/hasura/ndc-qdrant:v0.2.5 + dockerImage: ghcr.io/hasura/ndc-qdrant:v0.2.6 commandArgs: - update dockerComposeWatch: diff --git a/package-lock.json b/package-lock.json index 16c8ff2..d826a16 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ndc-qdrant", - "version": "0.2.5", + "version": "0.2.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ndc-qdrant", - "version": "0.2.5", + "version": "0.2.6", "dependencies": { "@hasura/ndc-sdk-typescript": "^6.0.0", "@qdrant/js-client-rest": "^1.5.0" diff --git a/package.json b/package.json index e36964a..d38fd24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ndc-qdrant", - "version": "0.2.5", + "version": "0.2.6", "main": "index.js", "scripts": { "start": "ts-node ./src/index.ts serve --configuration=.",