@@ -179,91 +179,94 @@ jobs:
179179 run : |
180180 echo "tagged_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
181181 shell : bash
182- # - uses: mindsers/changelog-reader-action@v2
183- # id: changelog-reader
184- # with:
185- # version: ${{ steps.get-version.outputs.tagged_version }}
186- # path: ./CHANGELOG.md
187- # - uses: softprops/action-gh-release@v1
188- # with:
189- # draft: false
190- # tag_name: v${{ steps.get-version.outputs.tagged_version }}
191- # body: ${{ steps.changelog-reader.outputs.changes }}
192- # files: |
193- # ./connector-definition/dist/connector-definition.tgz
194- # fail_on_unmatched_files: true
195182
196- # - name: Update ndc-hub
197- # env:
198- # REGISTRY_NAME: hasura
199- # CONNECTOR_NAME: ndc-python-lambda
200- # COMMIT_HASH: ${{ needs.build-connector.outputs.commit_hash }}
201- # SHA256: ${{ needs.build-connector.outputs.sha256 }}
202- # GH_TOKEN: ${{ secrets.PAT_TOKEN }}
203- # run: |
204- # # Clone ndc-hub repository
205- # git clone https://github.com/hasura/ndc-hub.git
206- # cd ndc-hub
183+ - uses : mindsers/changelog-reader-action@v2
184+ id : changelog-reader
185+ with :
186+ version : ${{ steps.get-version.outputs.tagged_version }}
187+ path : ./CHANGELOG.md
188+
189+ - uses : softprops/action-gh-release@v1
190+ with :
191+ draft : false
192+ tag_name : v${{ steps.get-version.outputs.tagged_version }}
193+ body : ${{ steps.changelog-reader.outputs.changes }}
194+ files : |
195+ ./connector-definition/dist/connector-definition.tgz
196+ fail_on_unmatched_files : true
207197
208- # # Create a new branch
209- # NEW_BRANCH="update-${{ env.CONNECTOR_NAME }}-connector-v${{ steps.get-version.outputs.tagged_version }}"
210- # git checkout -b $NEW_BRANCH
198+ - name : Update ndc-hub
199+ env :
200+ REGISTRY_NAME : hasura
201+ CONNECTOR_NAME : ndc-python-lambda
202+ COMMIT_HASH : ${{ needs.build-connector.outputs.commit_hash }}
203+ SHA256 : ${{ needs.build-connector.outputs.sha256 }}
204+ GH_TOKEN : ${{ secrets.PAT_TOKEN }}
205+ run : |
206+ # Clone ndc-hub repository
207+ git clone https://github.com/hasura/ndc-hub.git
208+ cd ndc-hub
211209
212- # cd registry/${{ env.REGISTRY_NAME }}/python
210+ # Create a new branch
211+ NEW_BRANCH="update-${{ env.CONNECTOR_NAME }}-connector-v${{ steps.get-version.outputs.tagged_version }}"
212+ git checkout -b $NEW_BRANCH
213213
214- # # Create releases directory if it doesn't exist
215- # mkdir -p releases/v${{ steps.get-version.outputs.tagged_version }}
214+ cd registry/${{ env.REGISTRY_NAME }}/python
216215
217- # # Create connector-packaging.json
218- # cat << EOF > releases/v${{ steps.get-version.outputs.tagged_version }}/connector-packaging.json
219- # {
220- # "version": "v${{ steps.get-version.outputs.tagged_version }}",
221- # "uri": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.get-version.outputs.tagged_version }}/connector-definition.tgz",
222- # "checksum": {
223- # "type": "sha256",
224- # "value": "$SHA256"
225- # },
226- # "source": {
227- # "hash": "$COMMIT_HASH"
228- # }
229- # }
230- # EOF
216+ # Create releases directory if it doesn't exist
217+ mkdir -p releases/v${{ steps.get-version.outputs.tagged_version }}
231218
232- # # Update metadata.json to remove 'packages' field if it exists and update 'latest_version'
233- # jq --arg version_tag "v${{ steps.get-version.outputs.tagged_version }}" \
234- # --arg commit_hash "$COMMIT_HASH" \
235- # 'if has("packages") then del(.packages) else . end |
236- # .overview.latest_version = $version_tag |
237- # if has("source_code") then
238- # .source_code.version += [{
239- # "tag": $version_tag,
240- # "hash": $commit_hash,
241- # "is_verified": false
242- # }]
243- # else
244- # . + {"source_code": {"version": [{
245- # "tag": $version_tag,
246- # "hash": $commit_hash,
247- # "is_verified": false
248- # }]}}
249- # end' \
250- # metadata.json > tmp.json && mv tmp.json metadata.json
219+ # Create connector-packaging.json
220+ cat << EOF > releases/v${{ steps.get-version.outputs.tagged_version }}/connector-packaging.json
221+ {
222+ "version": "v${{ steps.get-version.outputs.tagged_version }}",
223+ "uri": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.get-version.outputs.tagged_version }}/connector-definition.tgz",
224+ "checksum": {
225+ "type": "sha256",
226+ "value": "$SHA256"
227+ },
228+ "source": {
229+ "hash": "$COMMIT_HASH"
230+ },
231+ "test": {
232+ "test_config_path": "../../tests/test-config.json"
233+ }
234+ }
235+ EOF
251236
252- # cp ../../../../README.md ./README.md
237+ # Update metadata.json to remove 'packages' field if it exists and update 'latest_version'
238+ jq --arg version_tag "v${{ steps.get-version.outputs.tagged_version }}" \
239+ --arg commit_hash "$COMMIT_HASH" \
240+ 'if has("packages") then del(.packages) else . end |
241+ .overview.latest_version = $version_tag |
242+ if has("source_code") then
243+ .source_code.version += [{
244+ "tag": $version_tag,
245+ "hash": $commit_hash,
246+ "is_verified": false
247+ }]
248+ else
249+ . + {"source_code": {"version": [{
250+ "tag": $version_tag,
251+ "hash": $commit_hash,
252+ "is_verified": false
253+ }]}}
254+ end' \
255+ metadata.json > tmp.json && mv tmp.json metadata.json
253256
254- # # Commit changes
255- # git config user.name "GitHub Action"
256- # git config user.email "action@github.com"
257- # git add metadata.json README.md releases
258- # git commit -m "Update ${{ env.CONNECTOR_NAME }} connector metadata to version ${{ steps.get-version.outputs.tagged_version }}"
257+ # Commit changes
258+ git config user.name "GitHub Action"
259+ git config user.email "action@github.com"
260+ git add metadata.json README.md releases
261+ git commit -m "Update ${{ env.CONNECTOR_NAME }} connector metadata to version ${{ steps.get-version.outputs.tagged_version }}"
259262
260- # # Push changes
261- # git push https://${{ secrets.PAT_TOKEN }}@github.com/hasura/ndc-hub.git HEAD:$NEW_BRANCH
263+ # Push changes
264+ git push https://${{ secrets.PAT_TOKEN }}@github.com/hasura/ndc-hub.git HEAD:$NEW_BRANCH
262265
263- # # Create PR using GitHub CLI
264- # cd ../..
265- # gh pr create --repo hasura/ndc-hub \
266- # --base main \
267- # --head $NEW_BRANCH \
268- # --title "Update ${{ env.CONNECTOR_NAME }} connector to v${{ steps.get-version.outputs.tagged_version }}" \
269- # --body "This PR updates the ${{ env.CONNECTOR_NAME }} connector metadata to version ${{ steps.get-version.outputs.tagged_version }}."
266+ # Create PR using GitHub CLI
267+ cd ../..
268+ gh pr create --repo hasura/ndc-hub \
269+ --base main \
270+ --head $NEW_BRANCH \
271+ --title "Update ${{ env.CONNECTOR_NAME }} connector to v${{ steps.get-version.outputs.tagged_version }}" \
272+ --body "This PR updates the ${{ env.CONNECTOR_NAME }} connector metadata to version ${{ steps.get-version.outputs.tagged_version }}."
0 commit comments