fix: resolve composite actions secrets access errors #17
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 | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: latest | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile --ignore-scripts | |
| - name: Build TypeScript | |
| run: pnpm run build | |
| - name: Generate API documentation | |
| run: pnpm run docs:build | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: true | |
| working-directory: docs | |
| - name: Install Jekyll dependencies | |
| run: bundle install | |
| working-directory: docs | |
| - name: Build Jekyll site | |
| run: bundle exec jekyll build --baseurl="/node-syslog" | |
| working-directory: docs | |
| - name: Verify build output | |
| run: | | |
| echo "Checking Jekyll build output..." | |
| ls -la docs/_site/ | |
| echo "Checking API documentation..." | |
| ls -la docs/_site/api/ | |
| echo "Verifying no file conflicts..." | |
| if [ -f "docs/_site/api/index.html" ]; then | |
| echo "✅ API index.html found" | |
| else | |
| echo "❌ API index.html missing" | |
| exit 1 | |
| fi | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| id: pages | |
| with: | |
| # Enable automatic Pages site creation if it doesn't exist | |
| enablement: true | |
| continue-on-error: true | |
| - name: Pages Setup Status | |
| run: | | |
| if [ "${{ steps.pages.outcome }}" == "failure" ]; then | |
| echo "⚠️ GitHub Pages not configured for this repository" | |
| echo "📋 To enable GitHub Pages:" | |
| echo " 1. Go to repository Settings" | |
| echo " 2. Scroll to 'Pages' section" | |
| echo " 3. Source: Deploy from a branch" | |
| echo " 4. Branch: main" | |
| echo " 5. Folder: /docs" | |
| echo " 6. Save and retry this workflow" | |
| echo "" | |
| echo "🔗 Once configured, this workflow will deploy automatically" | |
| else | |
| echo "✅ GitHub Pages configured successfully" | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs/_site | |
| if: always() | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| id: pages | |
| with: | |
| enablement: true | |
| continue-on-error: true | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| if: steps.pages.outcome == 'success' | |
| with: | |
| error-urls: true | |
| - name: Deployment Status | |
| run: | | |
| if [ "${{ steps.pages.outcome }}" == "failure" ]; then | |
| echo "❌ Deployment skipped: GitHub Pages not configured" | |
| echo "" | |
| echo "📋 Manual setup required:" | |
| echo " Repository Settings → Pages → Source: Deploy from branch" | |
| echo " Branch: main, Folder: /docs" | |
| else | |
| echo "✅ Deployment completed successfully" | |
| echo "🌐 Site available at: ${{ steps.deployment.outputs.page_url }}" | |
| fi |