pr-preview #3
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: PR Preview 2 | |
| ##ToDo add an ok to preview for external PR's | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| - closed | |
| concurrency: preview-${{ github.ref }} | |
| jobs: | |
| deploy-preview: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Docforge | |
| run: | | |
| wget https://github.com/gardener/docforge/releases/download/v0.55.0/docforge-linux-amd64 | |
| mv docforge-linux-amd64 docforge | |
| chmod +x docforge | |
| DOCFORGE_CONFIG=.docforge/config.yaml GITHUB_OAUTH_TOKEN=${{ secrets.GITHUB_TOKEN }} ./docforge | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Postprocessing Content | |
| run: | | |
| npm run post-processing-all | |
| # Todo update but fine for now | |
| - name: Set Base Path | |
| id: set-base-path | |
| run: | | |
| if [ "${{ github.repository }}" != "gardener/documentation" ]; then | |
| echo "VITE_PUBLIC_BASE_PATH=/documentation/pr-preview/pr-${{ github.event.pull_request.number }}/" >> $GITHUB_ENV | |
| echo "Base path set to: /documentation/pr-preview/pr-${{ github.event.pull_request.number }}/ (fork deployment)" | |
| else | |
| echo "This should never be run on the main repo, use a dedicated repository for PR previews." | |
| exit | |
| fi | |
| - name: Build with VitePress | |
| run: | | |
| echo "Building with VITE_PUBLIC_BASE_PATH: '$VITE_PUBLIC_BASE_PATH'" | |
| npm run docs:build | |
| #- name: Generate GitHub App Token | |
| # id: app-token | |
| # uses: actions/create-github-app-token@v1 | |
| # with: | |
| # app-id: ${{ secrets.GARDENER_GITHUB_WORKFLOW_PKG_MNGR_APP_ID }} | |
| # private-key: ${{ secrets.GARDENER_GITHUB_WORKFLOW_PKG_MNGR_APP_PRIVATE_KEY }} | |
| - name: Deploy preview | |
| uses: rossjrw/pr-preview-action@v1 | |
| with: | |
| #token: ${{ steps.app-token.outputs.token }} | |
| token: ${{ secrets.PREVIEW_TOKEN }} | |
| deploy-repository: klocke-io/pr-preview | |
| source-dir: .vitepress/dist |