diff --git a/.github/workflows/release-postman.yml b/.github/workflows/release-postman.yml new file mode 100644 index 0000000000..b59f86da67 --- /dev/null +++ b/.github/workflows/release-postman.yml @@ -0,0 +1,21 @@ +name: Postman Release +on: + # Enabled by CLOUDP-262512 + # schedule: + # - cron: '0 0 10 ? * *' + workflow_dispatch: + +jobs: + release-postman: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Build and upload Collection + working-directory: ./tools/postman + env: + BASE_URL: ${{ secrets.BASE_URL }} + POSTMAN_API_KEY: ${{ secrets.POSTMAN_API_KEY }} + WORKSPACE_ID: ${{ secrets.WORKSPACE_ID }} + run: | + make build_and_upload diff --git a/tools/postman/scripts/transform-for-api.sh b/tools/postman/scripts/transform-for-api.sh index 7aced040d4..2b34a9274a 100755 --- a/tools/postman/scripts/transform-for-api.sh +++ b/tools/postman/scripts/transform-for-api.sh @@ -30,7 +30,7 @@ echo "Wrapping Collection in \"collection\" tag" jq '{"collection": .}' "$COLLECTION_FILE_NAME" > intermediateCollectionWrapped.json echo "Disabling query params by default" -jq '(.. | select(.request? != null).request.url.query.[].disabled) = true ' intermediateCollectionWrapped.json > intermediateCollectionDisableQueryParam.json +jq '(.. | select(.request? != null).request.url.query[].disabled) = true ' intermediateCollectionWrapped.json > intermediateCollectionDisableQueryParam.json # This is to be removed because it is autogenerated when a new collection is created echo "Removing _postman_id" @@ -40,7 +40,7 @@ echo "Updating name with version" jq '.collection.info.name = "MongoDB Atlas Administration API '"${current_api_revision}"'"' intermediateCollectionNoPostmanID.json > intermediateCollectionWithName.json echo "Updating baseUrl" -jq '.collection.variable.[0].value = "'"${BASE_URL}"'"' intermediateCollectionWithName.json > intermediateCollectionWithBaseURL.json +jq '.collection.variable[0].value = "'"${BASE_URL}"'"' intermediateCollectionWithName.json > intermediateCollectionWithBaseURL.json if [ "$USE_ENVIRONMENT_AUTH" = "false" ]; then echo "Adding auth variables" diff --git a/tools/postman/scripts/upload-collection.sh b/tools/postman/scripts/upload-collection.sh index 37892fde0c..e5e04dfb76 100755 --- a/tools/postman/scripts/upload-collection.sh +++ b/tools/postman/scripts/upload-collection.sh @@ -47,7 +47,7 @@ if [ "$collection_exists" = "false" ]; then else # Find collection ID and update collection echo "Updating remote collection ${current_collection_name}" - collection_id=$(jq -r '.collections | map(select(.name=="'"${current_collection_name}"'").id).[0]' "${COLLECTIONS_LIST_FILE}") + collection_id=$(jq -r '.collections | map(select(.name=="'"${current_collection_name}"'").id)[0]' "${COLLECTIONS_LIST_FILE}") curl --show-error --fail --retry 5 --retry-connrefused --silent --request PUT \ --location "https://api.getpostman.com/collections/${collection_id}" \ --header "Content-Type: application/json" \