Skip to content

Commit

Permalink
update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
TristenHarr committed Aug 6, 2024
1 parent dcae44b commit c71c0eb
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 5 deletions.
81 changes: 79 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
permissions:
contents: read
packages: write
outputs:
commit_hash: ${{ steps.get_commit_hash.outputs.commit_hash }}
sha256: ${{ steps.calculate_checksum.outputs.sha256 }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -43,7 +46,7 @@ jobs:
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
password: ${{ secrets.PAT_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
Expand Down Expand Up @@ -73,6 +76,18 @@ jobs:
path: ./connector-definition/dist/connector-definition.tgz
compression-level: 0 # Already compressed

- name: Calculate SHA256 checksum
id: calculate_checksum
run: |
SHA256=$(sha256sum ./connector-definition/dist/connector-definition.tgz | awk '{ print $1 }')
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
- name: Get commit hash
id: get_commit_hash
run: |
COMMIT_HASH=$(git rev-parse HEAD)
echo "commit_hash=$COMMIT_HASH" >> $GITHUB_OUTPUT
release-connector:
name: Release connector
runs-on: ubuntu-latest
Expand Down Expand Up @@ -101,4 +116,66 @@ jobs:
body: ${{ steps.changelog-reader.outputs.changes }}
files: |
./connector-definition/dist/connector-definition.tgz
fail_on_unmatched_files: true
fail_on_unmatched_files: true

- name: Update ndc-hub
env:
CONNECTOR_NAME: qdrant
COMMIT_HASH: ${{ needs.build-and-push-image.outputs.commit_hash }}
SHA256: ${{ needs.build-and-push-image.outputs.sha256 }}
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
# 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" \
--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
}]' \
metadata.json > tmp.json && mv tmp.json metadata.json

cp ../../../README.md ./README.md

# Commit changes
git config user.name "GitHub Action"
git config user.email "[email protected]"
git add metadata.json README.md
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 \
--base main \
--head $NEW_BRANCH \
--title "Update ${{ env.CONNECTOR_NAME }} connector to v${{ steps.get-version.outputs.tagged_version }}" \
--body "This PR updates the ${{ env.CONNECTOR_NAME }} connector metadata to version ${{ steps.get-version.outputs.tagged_version }}."
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.3] - 2024-08-06
* Update workflow to open a PR in ndc-hub

## [0.2.2] - 2024-08-05
* Update SDK to 5.2.0
* Pin version to 0.1.5
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.2",
"version": "0.2.3",
"main": "index.js",
"scripts": {
"start": "ts-node ./src/index.ts serve --configuration=.",
Expand Down

0 comments on commit c71c0eb

Please sign in to comment.