Skip to content

Update docs to be in 3.3 folder to allow for multi version docs #51

Update docs to be in 3.3 folder to allow for multi version docs

Update docs to be in 3.3 folder to allow for multi version docs #51

Workflow file for this run

name: Deploy to Render
on:
push:
branches: [dev, main]
pull_request:
branches: [dev, main]
# Prevent multiple concurrent deployments
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
name: Build Documentation
runs-on: ubuntu-latest
timeout-minutes: 90
outputs:
environment: ${{ steps.set-env.outputs.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Determine environment
id: set-env
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]] || [[ "${{ github.event_name }}" == "pull_request" && "${{ github.base_ref }}" == "main" ]]; then
echo "environment=Production" >> $GITHUB_OUTPUT
echo "SITE_URL=${{ secrets.PROD_URL }}" >> $GITHUB_ENV
else
echo "environment=Development" >> $GITHUB_OUTPUT
echo "SITE_URL=${{ secrets.DEV_URL }}" >> $GITHUB_ENV
fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Cache Docusaurus build
uses: actions/cache@v4
with:
path: |
.docusaurus
.cache
build/.cache
key: ${{ runner.os }}-docusaurus-build-${{ steps.set-env.outputs.environment }}-${{ hashFiles('**/package-lock.json', '**/docusaurus.config.js', 'docs/**/*.md', 'docs/**/*.mdx') }}
restore-keys: |
${{ runner.os }}-docusaurus-build-${{ steps.set-env.outputs.environment }}-
${{ runner.os }}-docusaurus-build-
- name: Cache webpack
uses: actions/cache@v4
with:
path: node_modules/.cache
key: ${{ runner.os }}-webpack-${{ steps.set-env.outputs.environment }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-webpack-${{ steps.set-env.outputs.environment }}-
${{ runner.os }}-webpack-
- name: Install dependencies
run: npm ci
- name: Build site
run: npm run build
env:
RENDER_EXTERNAL_URL: ${{ env.SITE_URL }}
- name: Validate build output
run: |
if [ ! -d "build" ]; then
echo "❌ Build directory not found!"
exit 1
fi
echo "✅ Build directory exists with $(find build -type f | wc -l) files"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ steps.set-env.outputs.environment }}
path: build/
retention-days: 1
deploy-dev:
name: Deploy to Development
needs: build
runs-on: ubuntu-latest
environment: Development
if: (github.ref == 'refs/heads/dev' || (github.event_name == 'pull_request' && github.base_ref == 'dev')) && needs.build.outputs.environment == 'Development'
permissions:
deployments: write
pull-requests: write # Needed to comment on PRs
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-Development
path: build/
- name: Deploy to Render Dev
id: deploy
uses: JorgeLNJunior/[email protected]
with:
service_id: ${{ secrets.RENDER_SERVICE_ID }}
api_key: ${{ secrets.RENDER_API_KEY }}
wait_deploy: true
github_deployment: true
deployment_environment: ${{ secrets.RENDER_DEPLOY_ENVIRONMENT }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Comment on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const deployUrl = '${{ secrets.SITE_URL }}';
const environment = 'Development';
const commentIdentifier = `<!-- deployment-bot:${environment} -->`;
const comment = `${commentIdentifier}
### 🚀 Preview Deployment Ready!
Your changes have been successfully deployed to the ${environment.toLowerCase()} environment.
**Preview URL:** ${deployUrl}
| Status | Environment | Commit | Time |
|--------|-------------|--------|------|
| ✅ Success | ${environment} | \`${context.sha.substring(0, 7)}\` | ${new Date().toISOString()} |
---
<sub>🤖 This comment was automatically generated by the deployment workflow.</sub>`;
// Find existing comment
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.find(comment =>
comment.body.includes(commentIdentifier)
);
if (botComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: comment
});
} else {
// Create new comment
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
}
deploy-prod:
name: Deploy to Production
needs: build
runs-on: ubuntu-latest
environment: Production
if: (github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.base_ref == 'main')) && needs.build.outputs.environment == 'Production'
permissions:
deployments: write
pull-requests: write # Needed to comment on PRs
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-Production
path: build/
- name: Deploy to Render Prod
id: deploy
uses: JorgeLNJunior/[email protected]
with:
service_id: ${{ secrets.RENDER_SERVICE_ID }}
api_key: ${{ secrets.RENDER_API_KEY }}
wait_deploy: true
github_deployment: true
deployment_environment: ${{ secrets.RENDER_DEPLOY_ENVIRONMENT }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Comment on PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const deployUrl = '${{ secrets.SITE_URL }}';
const environment = 'Production';
const commentIdentifier = `<!-- deployment-bot:${environment} -->`;
const comment = `${commentIdentifier}
### 🚀 Production Preview Deployment Ready!
Your changes have been successfully deployed to the ${environment.toLowerCase()} preview environment.
**Preview URL:** ${deployUrl}
| Status | Environment | Commit | Time |
|--------|-------------|--------|------|
| ✅ Success | ${environment} | \`${context.sha.substring(0, 7)}\` | ${new Date().toISOString()} |
⚠️ **Note:** This is a preview deployment for the production environment. The actual production deployment will occur after merge.
---
<sub>🤖 This comment was automatically generated by the deployment workflow.</sub>`;
// Find existing comment
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.find(comment =>
comment.body.includes(commentIdentifier)
);
if (botComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: comment
});
} else {
// Create new comment
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
}