chore: comprehensive cleanup of workflows, scripts and documentation #89
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 Documentation | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: "docs" | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| pages: write | |
| jobs: | |
| # === PARALLEL BUILD STAGE === | |
| setup-build-environment: | |
| name: Setup Build Environment | |
| runs-on: ubuntu-latest | |
| outputs: | |
| node-version: ${{ steps.node.outputs.version }} | |
| cache-key: ${{ steps.cache.outputs.key }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: latest | |
| - name: Setup Node.js | |
| id: node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "pnpm" | |
| - name: Generate cache key | |
| id: cache | |
| run: echo "key=deps-$(node -v)-$(pnpm -v)-${{ hashFiles('pnpm-lock.yaml') }}" >> $GITHUB_OUTPUT | |
| build-typescript: | |
| name: Build TypeScript | |
| runs-on: ubuntu-latest | |
| needs: setup-build-environment | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js and pnpm | |
| uses: ./.github/actions/setup-node-pnpm | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.pnpm-store | |
| key: ${{ needs.setup-build-environment.outputs.cache-key }} | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile --ignore-scripts | |
| - name: Build TypeScript | |
| run: pnpm run build | |
| generate-api-docs: | |
| name: Generate API Documentation | |
| runs-on: ubuntu-latest | |
| needs: setup-build-environment | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js and pnpm | |
| uses: ./.github/actions/setup-node-pnpm | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.pnpm-store | |
| key: ${{ needs.setup-build-environment.outputs.cache-key }} | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile --ignore-scripts | |
| - name: Generate API docs | |
| run: pnpm run docs:build | |
| setup-jekyll: | |
| name: Setup Jekyll Environment | |
| runs-on: ubuntu-latest | |
| needs: setup-build-environment | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.2" | |
| bundler-cache: true | |
| working-directory: docs | |
| # === DEPLOY STAGE === | |
| build-and-deploy: | |
| name: Build and Deploy Documentation | |
| runs-on: ubuntu-latest | |
| needs: [build-typescript, generate-api-docs, setup-jekyll] | |
| if: github.ref == 'refs/heads/main' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.2" | |
| bundler-cache: true | |
| working-directory: docs | |
| - name: Build Jekyll site | |
| run: | | |
| bundle exec jekyll build --baseurl="/node-syslog" | |
| working-directory: docs | |
| - name: Add .nojekyll | |
| run: | | |
| touch _site/.nojekyll | |
| rm -f _site/api/.nojekyll | |
| working-directory: docs | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs/_site | |
| publish_branch: gh-pages | |
| keep_files: false | |
| # cname: node-syslog.schamane.de | |