feat: Export Data UI (browser download) + UI static MIME fix #146
Workflow file for this run
This file contains hidden or 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: Deploy Documentation to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - Feb2026 # Feature branch for February 2026 release preview | |
| paths: | |
| - 'docs/**' | |
| - 'docs/package.json' | |
| - '.github/workflows/deploy-docs.yml' | |
| - 'CHANGELOG.md' | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'docs/**' | |
| - 'docs/package.json' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| security-scan: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: 'docs/package-lock.json' | |
| - name: Install dependencies | |
| run: cd docs && npm ci | |
| - name: Run security audit | |
| continue-on-error: true | |
| run: | | |
| cd docs | |
| npm audit --audit-level=moderate || true | |
| - name: Check for vulnerabilities | |
| continue-on-error: true | |
| run: | | |
| cd docs | |
| AUDIT_RESULT=$(npm audit --json || true) | |
| echo "$AUDIT_RESULT" | |
| if command -v jq &> /dev/null; then | |
| VULNERABILITIES=$(echo "$AUDIT_RESULT" | jq '.metadata.vulnerabilities.total // 0' 2>/dev/null || echo "0") | |
| if [ "$VULNERABILITIES" -gt 0 ] 2>/dev/null; then | |
| echo "::warning::Found $VULNERABILITIES vulnerabilities in documentation dependencies" | |
| fi | |
| else | |
| echo "::notice::jq not available, skipping detailed vulnerability analysis" | |
| fi | |
| build: | |
| name: Build Documentation | |
| runs-on: ubuntu-latest | |
| needs: security-scan | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 # Fetch all history for VitePress lastUpdated feature | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: 'docs/package-lock.json' | |
| - name: Cache VitePress build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| docs/.vitepress/.temp | |
| docs/.vitepress/cache | |
| key: ${{ runner.os }}-vitepress-${{ hashFiles('docs/**/*.md', 'docs/.vitepress/**') }} | |
| restore-keys: | | |
| ${{ runner.os }}-vitepress- | |
| - name: Install dependencies | |
| run: cd docs && npm ci | |
| - name: Build VitePress documentation | |
| run: cd docs && npm run docs:build | |
| - name: Verify build output | |
| run: | | |
| if [ ! -d "docs/.vitepress/dist" ]; then | |
| echo "Error: Build output directory not found" | |
| exit 1 | |
| fi | |
| if [ ! -f "docs/.vitepress/dist/index.html" ]; then | |
| echo "Error: index.html not found in build output" | |
| exit 1 | |
| fi | |
| echo "Build verification successful" | |
| - name: Check for broken links | |
| id: link-check | |
| continue-on-error: true | |
| run: | | |
| # Use lychee for fast parallel link checking of the built HTML | |
| curl -sSfL https://github.com/lycheeverse/lychee/releases/latest/download/lychee-x86_64-unknown-linux-gnu.tar.gz \ | |
| | tar xz --strip-components=1 -C /usr/local/bin lychee-x86_64-unknown-linux-gnu/lychee | |
| # Mirror deployment structure (GitHub Pages serves under /repo-name/) | |
| mkdir -p /tmp/site/hana-developer-cli-tool-example | |
| cp -r docs/.vitepress/dist/* /tmp/site/hana-developer-cli-tool-example/ | |
| # Check internal links only; fallback-extensions handles VitePress clean URLs | |
| lychee \ | |
| --offline \ | |
| --root-dir /tmp/site \ | |
| --fallback-extensions html \ | |
| /tmp/site | |
| rm -rf /tmp/site | |
| - name: Report link check results | |
| if: steps.link-check.outcome == 'failure' | |
| run: echo "::warning::Broken links detected in documentation" | |
| - name: Setup GitHub Pages | |
| if: github.event_name != 'pull_request' | |
| uses: actions/configure-pages@v6 | |
| - name: Upload artifact | |
| if: github.event_name != 'pull_request' | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: docs/.vitepress/dist | |
| retention-days: 1 | |
| - name: Upload PR preview artifact | |
| if: github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: pr-preview-${{ github.event.pull_request.number }} | |
| path: docs/.vitepress/dist | |
| retention-days: 7 | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| if: github.event_name != 'pull_request' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| outputs: | |
| page_url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 | |
| notify: | |
| name: Deployment Notification | |
| if: github.event_name != 'pull_request' && always() | |
| needs: [build, deploy] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send deployment notification | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| DEPLOY_STATUS: ${{ needs.deploy.result }} | |
| DEPLOY_URL: ${{ needs.deploy.outputs.page_url }} | |
| run: | | |
| if [ -n "$SLACK_WEBHOOK_URL" ]; then | |
| EMOJI="✅" | |
| COLOR="good" | |
| if [ "$DEPLOY_STATUS" != "success" ]; then | |
| EMOJI="❌" | |
| COLOR="danger" | |
| fi | |
| DOCS_URL="${DEPLOY_URL:-https://sap-samples.github.io/hana-developer-cli-tool-example/}" | |
| curl -X POST "$SLACK_WEBHOOK_URL" \ | |
| -H 'Content-Type: application/json' \ | |
| -d "{ | |
| \"text\": \"$EMOJI Documentation Deployment: $DEPLOY_STATUS\", | |
| \"attachments\": [{ | |
| \"color\": \"$COLOR\", | |
| \"fields\": [ | |
| {\"title\": \"Repository\", \"value\": \"${{ github.repository }}\", \"short\": true}, | |
| {\"title\": \"Branch\", \"value\": \"${{ github.ref_name }}\", \"short\": true}, | |
| {\"title\": \"Commit\", \"value\": \"<${{ github.event.head_commit.url }}|${GITHUB_SHA:0:7}>\", \"short\": true}, | |
| {\"title\": \"URL\", \"value\": \"<$DOCS_URL|View Documentation>\", \"short\": true} | |
| ] | |
| }] | |
| }" | |
| else | |
| echo "Slack webhook not configured. Skipping notification." | |
| echo "To enable notifications, add SLACK_WEBHOOK_URL secret to repository settings." | |
| fi | |
| - name: Comment on PR | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| echo "Documentation preview built successfully for PR #${{ github.event.pull_request.number }}" | |
| echo "Artifact: pr-preview-${{ github.event.pull_request.number }}" |