Skip to content

docs(hub): rewrite Generate an element template #40394

docs(hub): rewrite Generate an element template

docs(hub): rewrite Generate an element template #40394

Workflow file for this run

name: build-docs
on: pull_request
# If the workflow is triggered while an instance is already running,
# cancel the in-progress instance.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-docs:
# Use self-hosted runner with more resources
runs-on: gcp-core-16-default
# The execution of a job shares the same container and resources as the runner agent
# that communicates with GitHub. Excessive and intensive consumption of resources
# by a job steps may starve the runner agent to the point where communication is lost,
# forcing GitHub to consider it offline. To prevent this, we can use a separate container
# with its own resources for the job execution.
container: node:24
steps:
- uses: actions/checkout@v7
- name: Install Dependencies
run: npm ci
# Removed because it's causing build issues
# - name: Cache Docusaurus
# uses: ./.github/actions/docusaurus-cache
- name: Build
run: npm run build
env:
NODE_OPTIONS: --max-old-space-size=30720
- name: Upload build
uses: actions/upload-artifact@v7
with:
name: docs-build
path: build
include-hidden-files: true
validate-links:
runs-on: gcp-core-16-default
needs: build-docs
env:
temporary_link_path: .github/workflows/validate-links
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Download build
uses: actions/download-artifact@v8
with:
name: docs-build
path: build
- name: Install hyperlink
run: npm install -g @untitaker/hyperlink
- name: Check internal links
uses: untitaker/hyperlink@0.3.2
with:
args: build/
- name: Remove https redirect
run: |
sed -i '/SERVER_PORT/d;/SERVER_NAME/d' build/.htaccess
- name: Run a web server for link checking
run: |
docker run -d --name webserver -v "$PWD/build":/app -p 8888:8080 bitnamilegacy/apache:2.4.54
container_ip=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' webserver)
echo "container_ip=${container_ip}" >> $GITHUB_ENV
echo "domain_to_test=http://${container_ip}:8080" >> $GITHUB_ENV
- name: Wait for running docs web server
uses: nev7n/wait_for_response@v1
with:
url: ${{ env.domain_to_test }}
- name: Download sitemap from production
run: curl -sL https://docs.camunda.io/sitemap.xml | grep -oP '<loc>\K.*?(?=</loc>)' > sitemap.prod.txt
- name: Remove known broken anchors.
run: |
sed -i 's!power-automate/#oauth-token-endpoint!power-automate/!g' connectors-element-template-links.txt
- name: Prepare link collections
# Turn static lists of URLs into HTML files with anchor tags.
run: |
mkdir -p ${temporary_link_path}
sed "s!https://docs\.camunda\.io\(.*\)!<a href=\"${domain_to_test}\1\">link</a>!g" \
sitemap.prod.txt \
> ${temporary_link_path}/sitemap-prod.html
sed "s!https://docs\.camunda\.io\(.*\)!<a href=\"${domain_to_test}\1\">link</a>!g" \
product-links.txt \
> ${temporary_link_path}/product-links.html
sed "s!https://docs\.camunda\.io\(.*\)!<a href=\"${domain_to_test}\1\">link</a>!g" \
connectors-element-template-links.txt \
> ${temporary_link_path}/connectors-element-template-links.html
- name: Serve link collections
## Run another web server because Muffet only works against web pages, not source files.
uses: Eun/http-server-action@v1
with:
directory: ${{ env.temporary_link_path }}
port: 8081
- name: Validate sitemap links
uses: ./.github/actions/muffet
with:
url_to_validate: http://localhost:8081/sitemap-prod.html
- name: Validate product links
uses: ./.github/actions/muffet
with:
url_to_validate: http://localhost:8081/product-links.html
- name: Validate element template links
uses: ./.github/actions/muffet
with:
url_to_validate: http://localhost:8081/connectors-element-template-links.html
retry-shutdowns:
# Because we run these jobs on preemptible runners, they can be shut down
# automatically at any time. Instead of requiring a manual rerun every time
# this happens, use the reusable action developed by the infra team to retry.
runs-on: ubuntu-latest
needs:
- build-docs
- validate-links
if: failure() && fromJSON(github.run_attempt) < 3
steps:
- name: Retry job
uses: camunda/infra-global-github-actions/rerun-failed-run@main
with:
error-messages: |
The runner has received a shutdown signal.
The operation was canceled.
run-id: ${{ github.run_id }}
repository: ${{ github.repository }}
vault-addr: ${{ secrets.VAULT_ADDR }}
vault-role-id: ${{ secrets.VAULT_ROLE_ID }}
vault-secret-id: ${{ secrets.VAULT_SECRET_ID }}