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 ecd084a commit 2a5bf1c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 28 deletions.
60 changes: 37 additions & 23 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ jobs:

- name: Update ndc-hub
env:
REGISTRY_NAME: hasura
CONNECTOR_NAME: turso
COMMIT_HASH: ${{ needs.build-and-push-image.outputs.commit_hash }}
SHA256: ${{ needs.build-and-push-image.outputs.sha256 }}
Expand All @@ -131,31 +132,44 @@ jobs:
NEW_BRANCH="update-${{ env.CONNECTOR_NAME }}-connector-v${{ steps.get-version.outputs.tagged_version }}"
git checkout -b $NEW_BRANCH

cd registry/${{ env.CONNECTOR_NAME }}
cd registry/${{ env.REGISTRY_NAME }}/${{ 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" \
# 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
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This changelog documents changes between release tags.
## [Unreleased]
Upcoming changes for the next versioned release.

## [0.0.31]
* Update workflow to automate NDC-hub PR

## [0.0.30]
* Update SDK version

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-turso:v0.0.30
dockerImage: ghcr.io/hasura/ndc-turso:v0.0.31
supportedEnvironmentVariables:
- name: TURSO_URL
description: The url for the Turso database
Expand All @@ -9,7 +9,7 @@ supportedEnvironmentVariables:
commands:
update:
type: Dockerized
dockerImage: ghcr.io/hasura/ndc-turso:v0.0.30
dockerImage: ghcr.io/hasura/ndc-turso:v0.0.31
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-turso",
"version": "0.0.30",
"version": "0.0.31",
"main": "index.js",
"author": "Tristen Harr",
"scripts": {
Expand Down

0 comments on commit 2a5bf1c

Please sign in to comment.