task(Devx) - Wallet docs updates #279
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Preview Wiki In PR | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.WIKI_VERCEL_PROJECT_ID }} | |
permissions: | |
contents: read | |
pull-requests: write | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, synchronize, reopened, ready_for_review] | |
paths: | |
- "docs/**" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
wiki-preview: | |
runs-on: self-hosted | |
if: github.event.pull_request.draft == false | |
steps: | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # pin@v4 | |
with: | |
run_install: false | |
- name: Set up Node.js | |
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # pin@v4 | |
with: | |
node-version: 20 | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build wiki | |
run: pnpm iota-docs build | |
- name: Install Vercel CLI | |
run: npm install --global vercel@latest | |
- name: Pull Vercel Environment Information | |
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | |
working-directory: ./docs/site | |
- name: Build Project Artifacts | |
run: vercel build --token=${{ secrets.VERCEL_TOKEN }} | |
working-directory: ./docs/site | |
- name: Deploy Project Artifacts to Vercel | |
run: | | |
DEPLOYMENT_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}) | |
echo "DEPLOYMENT_URL=$DEPLOYMENT_URL" >> $GITHUB_ENV | |
working-directory: ./docs/site | |
- name: Update PR with Deployment URL | |
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # pin@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const deploymentUrl = process.env.DEPLOYMENT_URL; | |
const body = `✅ Vercel Preview Deployment is ready! | |
[View Preview](${deploymentUrl})`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}); |