Merge pull request #2700 from ORCID/lmendoza/PD-3848 #12
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: Build and Deploy UI Docs | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'projects/orcid-ui-docs/**' | |
| - 'projects/orcid-ui/**' | |
| - 'projects/orcid-tokens/**' | |
| - 'package.json' | |
| - 'angular.json' | |
| - '.github/workflows/deploy-ui-docs.yml' | |
| workflow_dispatch: | |
| # Allows manual triggering via GitHub CLI or GitHub UI | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build orcid-ui-docs | |
| run: yarn build:ui-docs --base-href /orcid-angular/ | |
| continue-on-error: false | |
| - name: Determine build output directory | |
| id: set-output | |
| run: | | |
| if [ -d "dist/orcid-ui-docs/browser" ]; then | |
| echo "directory=dist/orcid-ui-docs/browser" >> "$GITHUB_OUTPUT" | |
| elif [ -d "dist/orcid-ui-docs" ]; then | |
| echo "directory=dist/orcid-ui-docs" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "ERROR: Build output directory not found" >&2 | |
| ls -la dist/ >&2 | |
| exit 1 | |
| fi | |
| - name: Setup SPA support for GitHub Pages | |
| run: | | |
| BUILD_DIR="${{ steps.set-output.outputs.directory }}" | |
| # Copy index.html to 404.html for SPA routing support | |
| # This 404.html will handle routes within THIS specific SPA | |
| cp "$BUILD_DIR/index.html" "$BUILD_DIR/404.html" | |
| # Note: .nojekyll is already in the repo root and will be preserved | |
| echo "✅ SPA support configured: 404.html created for root deployment" | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ${{ steps.set-output.outputs.directory }} | |
| destination_dir: . # Deploy to root for main branch | |
| keep_files: true # Keep PR preview deployments in /runway/* and .nojekyll | |
| exclude_assets: '.nojekyll' # Don't delete the .nojekyll file | |
| cname: false | |