Skip to content

Update crates to 0.13.1 #838

Update crates to 0.13.1

Update crates to 0.13.1 #838

Workflow file for this run

name: Documentation CI/CD
on:
push:
paths:
- "documentation/**"
env:
FOUNDRY_VERSION: v1.2.2
jobs:
build-and-deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./documentation
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Get latest tag
id: get_latest_tag
run: echo "LATEST_TAG=$(git describe --tags --abbrev=0 | sed 's/^v//')" >> $GITHUB_ENV
- name: 🍞 Setup Bun
uses: risc0/[email protected]
with:
bun-version: 1.1.38
- name: Install dependencies
run: bun install
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: ${{ env.FOUNDRY_VERSION }}
- name: Run CI checks & build
env:
LATEST_TAG: ${{ env.LATEST_TAG }}
run: bun run ci
- name: Install Vercel CLI
run: |
bun install --global vercel@latest
vercel telemetry disable
- name: Deploy to Vercel
id: deploy
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: team_7ekBjCLrY6obIej6ulZx7iCg
VERCEL_PROJECT_ID: prj_52J4bKnmBJxkhM6DQIxXBPsI2L7N
run: |
if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
DEPLOYMENT_URL=$(vercel deploy site/dist --prod --token=${{ secrets.VERCEL_TOKEN }} --yes)
else
DEPLOYMENT_URL=$(vercel deploy site/dist --token=${{ secrets.VERCEL_TOKEN }} --yes)
fi
echo "deployment_url=$DEPLOYMENT_URL" >> $GITHUB_OUTPUT
- name: Find or Create Comment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Try to find PR number from the commit
PR_NUMBER=$(gh pr list --search "${{ github.sha }}" --json number --jq '.[0].number')
if [ ! -z "$PR_NUMBER" ]; then
# If we found a PR, comment on it
COMMENTS_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
else
# If no PR found, comment on the commit
COMMIT_SHA=${{ github.sha }}
COMMENTS_URL="https://api.github.com/repos/${{ github.repository }}/commits/${COMMIT_SHA}/comments"
fi
# Get all comments
COMMENTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$COMMENTS_URL")
# Find existing comment ID
COMMENT_ID=$(echo "$COMMENTS" | jq -r '.[] | select(.body | contains("🚀 Documentation Preview")) | .id' | head -n1)
# Updated comment body with both URLs
COMMENT_BODY="🚀 Documentation Preview\n\nDeployment URL: ${{ steps.deploy.outputs.deployment_url }}\n\n_Updated at: $(date -u +'%Y-%m-%d %H:%M:%S UTC')_"
# Create JSON payload
PAYLOAD="{\"body\":\"$COMMENT_BODY\"}"
if [ ! -z "$PR_NUMBER" ]; then
if [ ! -z "$COMMENT_ID" ]; then
# Update existing PR comment
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-X PATCH \
-d "$PAYLOAD" \
"https://api.github.com/repos/${{ github.repository }}/issues/comments/${COMMENT_ID}"
else
# Create new PR comment
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-X POST \
-d "$PAYLOAD" \
"$COMMENTS_URL"
fi
else
# For commits without PRs, create a commit comment
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/json" \
-X POST \
-d "$PAYLOAD" \
"$COMMENTS_URL"
fi