Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
TristenHarr committed Aug 13, 2024
1 parent b167ecb commit 22745b0
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 38 deletions.
80 changes: 47 additions & 33 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 \
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
4 changes: 2 additions & 2 deletions connector-definition/connector-metadata.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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=.",
Expand Down

0 comments on commit 22745b0

Please sign in to comment.