Skip to content

[DVR-459] fix: updated ci/cd pipeline to make a new PR instead of pushing to main #2656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/actions/notify-slack-publish-status/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ inputs:
description: 'Message to send to Slack'
required: true
default: ''
webhook-url:
description: 'Slack incoming webhook URL'
required: true
runs:
using: 'node20'
main: 'index.js'
2 changes: 1 addition & 1 deletion .github/actions/notify-slack-publish-status/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const core = require('@actions/core');
const webhook = process.env.SDK_PUBLISH_SLACK_WEBHOOK;
const webhook = core.getInput('webhook-url');

const run = async () => {
if (webhook) {
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/process-tutorials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ for PRODUCT in "${PRODUCTS[@]}"; do
echo "Processing tutorials for $PRODUCT..."

# Create _tutorials directory in docs repo if it doesn't exist
TUTORIALS_DIR="$DOCS_REPO_DIR/docs/main/example/zkEVM/$PRODUCT-examples/_tutorials"
TUTORIALS_DIR="$DOCS_REPO_DIR/docs/main/build/typescript/usage-guides/$PRODUCT"
mkdir -p "$TUTORIALS_DIR"

# Get all example apps for this product
Expand All @@ -42,7 +42,7 @@ for PRODUCT in "${PRODUCTS[@]}"; do
JSON_FILE="$EXAMPLES_ROOT/_parsed/${PRODUCT}-examples.json"
if [ -f "$JSON_FILE" ]; then
# Create directory for JSON file if it doesn't exist
JSON_DIR="$DOCS_REPO_DIR/docs/main/example/zkEVM/$PRODUCT-examples"
JSON_DIR="$DOCS_REPO_DIR/docs/main/build/typescript/usage-guides/$PRODUCT"
mkdir -p "$JSON_DIR"

# Copy JSON file
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ jobs:
uses: ./.github/actions/notify-slack-publish-status
with:
message: "✅ SDK reference documents published successfully - https://docs.immutable.com/sdk-references/ts-immutable-sdk/${{ env.VERSION }}/\n\n>*`${{ env.GITHUB_USER }}` Please ensure you and the team updated all Sample Code + Guides on the <https://docs.immutable.com|imx-docs site> to reflect the change.*"

webhook-url: ${{ secrets.SDK_PUBLISH_SLACK_WEBHOOK }}

- name: Notify SDK Slack Docs Publish Failure
if: ${{ failure() && steps.docs_version_check.conclusion == 'success' }}
uses: ./.github/actions/notify-slack-publish-status
with:
message: "❌ Failed to publish SDK reference documents. Please check the logs for more details."
webhook-url: ${{ secrets.SDK_PUBLISH_SLACK_WEBHOOK }}
49 changes: 33 additions & 16 deletions .github/workflows/publish-example-tutorials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
ref: main

- name: Checkout Docs Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
repository: immutable/docs
token: ${{ secrets.TS_IMMUTABLE_SDK_GITHUB_TOKEN }}
path: imx-docs
ref: main
ref: DVR-295-docs-restructure

- name: Setup environment variables
run: |
Expand All @@ -59,21 +58,39 @@ jobs:
./.github/scripts/process-tutorials.sh
shell: bash

- name: Commit and Push Changes to Docs Repo
- name: Create Pull Request in Docs Repo
id: create_pr
run: |
cd "$CLONE_DIR"
# Check if there are changes to commit
if git status --porcelain | grep -q .; then
# Add all changes
git add .

# Commit the changes
git commit -m "Update example app tutorials from SDK repo"

# Push to the target branch
git push -u origin main
echo "Successfully pushed example app tutorial changes to docs repo"
else
if ! git status --porcelain | grep -q .; then
echo "No changes to commit"
echo "pr_url=" >> $GITHUB_OUTPUT
exit 0
fi
shell: bash

BRANCH_NAME="chore/ts-sdk-docs-update-${{ github.run_id }}"
git checkout -b $BRANCH_NAME

git add .
git commit -m "chore: example app usage guide updated"
git push -u origin $BRANCH_NAME
echo "Successfully pushed changes to docs repo on branch $BRANCH_NAME"

PR_URL=$(gh pr create \
--title "auto(ts-immutable-sdk): example app usage guide updated" \
--body "Automated PR from ts-immutable-sdk to update tutorials. This is safe for anyone to approve and merge." \
--base DVR-295-docs-restructure \
--repo immutable/docs)

echo "Successfully created PR in docs repo: $PR_URL"
echo "pr_url=${PR_URL}" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.TS_IMMUTABLE_SDK_GITHUB_TOKEN }}
shell: bash

- name: Notify Slack
if: steps.create_pr.outputs.pr_url != ''
uses: ./.github/actions/notify-slack-publish-status
with:
message: 'New automated TS SDK sample app tutorials PR is ready for review: ${{ steps.create_pr.outputs.pr_url }}'
webhook-url: ${{ secrets.SDK_DOCS_TUTORIALS_SLACK_WEBHOOK }}
2 changes: 2 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@ jobs:
uses: ./.github/actions/notify-slack-publish-status
with:
message: "✅ ${{ github.triggering_actor }} successfully published SDK packages @ version ${{steps.release.outputs.RELEASE_NAME}} to NPM.\n\nhttps://www.npmjs.com/package/@imtbl/sdk/v/${{steps.release.outputs.RELEASE_NAME}}"
webhook-url: ${{ secrets.SDK_PUBLISH_SLACK_WEBHOOK }}

- name: Notify SDK Slack Publish Failure
if: ${{ failure() && (steps.npm_release.conclusion == 'failure') && env.DRY_RUN == 'false' }}
uses: ./.github/actions/notify-slack-publish-status
with:
message: "❌ Failed to publish SDK version ${{steps.release.outputs.RELEASE_NAME}} to NPM. ${{ github.triggering_actor }} please check the logs for more details."
webhook-url: ${{ secrets.SDK_PUBLISH_SLACK_WEBHOOK }}

- name: Wait for NPM @latest Update
id: wait_for_npm_update
Expand Down
4 changes: 4 additions & 0 deletions examples/_parsed/checkout-examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
],
"product": "Checkout",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 1
}
},
Expand All @@ -44,6 +45,7 @@
],
"product": "Checkout",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 4
}
},
Expand All @@ -68,6 +70,7 @@
],
"product": "Checkout",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 3
}
},
Expand All @@ -92,6 +95,7 @@
],
"product": "Checkout",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 2
}
}
Expand Down
1 change: 1 addition & 0 deletions examples/_parsed/contracts-examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
],
"product": "Contracts",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 1
}
}
Expand Down
6 changes: 6 additions & 0 deletions examples/_parsed/orderbook-examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
],
"product": "Orderbook",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 2
}
},
Expand All @@ -49,6 +50,7 @@
],
"product": "Orderbook",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 3
}
},
Expand All @@ -74,6 +76,7 @@
],
"product": "Orderbook",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 1
}
},
Expand All @@ -99,6 +102,7 @@
],
"product": "Orderbook",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 5
}
},
Expand All @@ -125,6 +129,7 @@
],
"product": "Orderbook",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 6
}
},
Expand All @@ -150,6 +155,7 @@
],
"product": "Orderbook",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 4
}
}
Expand Down
19 changes: 15 additions & 4 deletions examples/_parsed/passport-examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@
"logged-in-user-with-nextjs": {
"tutorial": "logged-in-user-with-nextjs.md",
"metadata": {
"title": "User Information after Logging In with NextJS",
"description": "Example of retrieving and displaying user data after authentication with Immutable Passport in a NextJS application",
"title": "Logged-in User with NextJS",
"description": "Example app demonstrating how to access user information and manage linked addresses after a user has logged in with Immutable Passport in a NextJS application",
"keywords": [
"Immutable",
"SDK",
"Passport",
"NextJS",
"Authentication",
"User Info",
"Linked Addresses",
"Tokens"
"Token Verification",
"Wallet Linking"
],
"tech_stack": [
"NextJS",
"React",
"TypeScript",
"React"
"Ethereum",
"MetaMask"
],
"product": "Passport",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 3
}
},
Expand All @@ -46,6 +51,7 @@
],
"product": "Passport",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 2
}
},
Expand Down Expand Up @@ -73,6 +79,7 @@
],
"product": "Passport",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 1
}
},
Expand All @@ -98,6 +105,7 @@
],
"product": "Passport",
"programming_language": "TypeScript",
"deprecated": true,
"sidebar_order": 7
}
},
Expand Down Expand Up @@ -126,6 +134,7 @@
],
"product": "Passport",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 4
}
},
Expand All @@ -150,6 +159,7 @@
],
"product": "Passport",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 6
}
},
Expand All @@ -173,6 +183,7 @@
],
"product": "Passport",
"programming_language": "TypeScript",
"deprecated": false,
"sidebar_order": 5
}
}
Expand Down
3 changes: 2 additions & 1 deletion examples/checkout/sdk-connect-with-nextjs/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"keywords": ["Immutable", "SDK", "Checkout", "MetaMask", "Web3", "Connect Wallet"],
"tech_stack": ["Next.js", "TypeScript", "Ethers.js"],
"product": "Checkout",
"programming_language": "TypeScript"
"programming_language": "TypeScript",
"deprecated": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"keywords": ["Immutable", "SDK", "Gas Estimation", "Checkout", "MetaMask", "Next.js", "Swap", "Bridge"],
"tech_stack": ["Next.js", "TypeScript", "ethers.js"],
"product": "Checkout",
"programming_language": "TypeScript"
"programming_language": "TypeScript",
"deprecated": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"keywords": ["Immutable", "SDK", "MetaMask", "Network Switching", "Checkout", "Wallet Connection"],
"tech_stack": ["Next.js", "TypeScript", "React", "Ethers.js"],
"product": "Checkout",
"programming_language": "TypeScript"
"programming_language": "TypeScript",
"deprecated": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"keywords": ["Immutable", "SDK", "Wallet", "Balance", "MetaMask", "Token", "NextJS"],
"tech_stack": ["NextJS", "TypeScript", "ethers.js"],
"product": "Checkout",
"programming_language": "TypeScript"
"programming_language": "TypeScript",
"deprecated": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"Immutable Contracts"
],
"product": "Contracts",
"programming_language": "TypeScript"
"programming_language": "TypeScript",
"deprecated": false
}
3 changes: 2 additions & 1 deletion examples/orderbook/create-bid-with-nextjs/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"keywords": ["Immutable", "SDK", "Orderbook", "Create Bid", "ERC721", "ERC1155", "Next.js"],
"tech_stack": ["Next.js", "TypeScript", "React", "Immutable SDK", "Passport SDK", "Orderbook SDK"],
"product": "Orderbook",
"programming_language": "TypeScript"
"programming_language": "TypeScript",
"deprecated": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"keywords": ["Immutable", "SDK", "Orderbook", "Collection Bid", "ERC721", "ERC1155", "Next.js"],
"tech_stack": ["Next.js", "React", "TypeScript", "Immutable SDK", "Passport"],
"product": "Orderbook",
"programming_language": "TypeScript"
"programming_language": "TypeScript",
"deprecated": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"keywords": ["Immutable", "SDK", "Orderbook", "Create Listing", "ERC721", "ERC1155", "Next.js"],
"tech_stack": ["Next.js", "TypeScript", "Immutable SDK", "ethers.js"],
"product": "Orderbook",
"programming_language": "TypeScript"
"programming_language": "TypeScript",
"deprecated": false
}
3 changes: 2 additions & 1 deletion examples/orderbook/fulfill-bid-with-nextjs/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"keywords": ["Immutable", "SDK", "Orderbook", "Fulfill Bid", "ERC721", "ERC1155", "Next.js"],
"tech_stack": ["Next.js", "TypeScript", "Immutable SDK", "Ethers.js"],
"product": "Orderbook",
"programming_language": "TypeScript"
"programming_language": "TypeScript",
"deprecated": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"keywords": ["Immutable", "SDK", "Orderbook", "Collection Bid", "Fulfill", "ERC721", "ERC1155", "Next.js"],
"tech_stack": ["Next.js", "React", "TypeScript", "Immutable SDK"],
"product": "Orderbook",
"programming_language": "TypeScript"
"programming_language": "TypeScript",
"deprecated": false
}
Loading