|
| 1 | +# Sample workflow for building and deploying a VitePress site to GitHub Pages |
| 2 | +# |
| 3 | +name: Deploy VitePress site to Pages (next) |
| 4 | + |
| 5 | +on: |
| 6 | + # Runs on pushes targeting the `main` branch. Change this to `master` if you're |
| 7 | + # using the `master` branch as the default branch. |
| 8 | + push: |
| 9 | + branches: [enable-documentation-ci] |
| 10 | + |
| 11 | + # Allows you to run this workflow manually from the Actions tab |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 15 | +permissions: |
| 16 | + contents: write |
| 17 | + pages: write |
| 18 | + id-token: write |
| 19 | + |
| 20 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 21 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 22 | +concurrency: |
| 23 | + group: pages |
| 24 | + cancel-in-progress: false |
| 25 | + |
| 26 | +jobs: |
| 27 | + # Build job |
| 28 | + build: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + env: |
| 31 | + DOC_VERSION: v5 |
| 32 | + DOC_ALIAS: stable |
| 33 | + GIT_COMMITTER_NAME: "Konrad Kost" |
| 34 | + GIT_COMMITTER_EMAIL: "xxxx" |
| 35 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + steps: |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@v4 |
| 39 | + with: |
| 40 | + fetch-depth: 0 |
| 41 | + - name: Setup Node |
| 42 | + uses: actions/setup-node@v4 |
| 43 | + with: |
| 44 | + node-version: 20 |
| 45 | + cache: npm |
| 46 | + - name: Setup Pages |
| 47 | + uses: actions/configure-pages@v4 |
| 48 | + - name: Install dependencies |
| 49 | + run: npm ci |
| 50 | + - name: Install documentation dependencies |
| 51 | + run: cd packages/documentation && npm ci |
| 52 | + - name: Fetch gh-pages branch |
| 53 | + run: git fetch origin gh-pages --depth=1 |
| 54 | + - name: Set /site ownership to current user |
| 55 | + run: | |
| 56 | + mkdir site |
| 57 | + sudo chown -R $(id -u):$(id -g) ./site |
| 58 | + - name: generate CLI doc |
| 59 | + run: npm run generate-cli-doc |
| 60 | + - name: generate next config |
| 61 | + run: npm run replace-base-path-next |
| 62 | + - name: Build jsdoc |
| 63 | + run: npm run jsdoc-generate |
| 64 | + - name: Build vitepress build |
| 65 | + run: npm run docs:build |
| 66 | + - name: Build Schema |
| 67 | + run: | |
| 68 | + npm run schema-generate |
| 69 | + npm run schema-workspace-generate |
| 70 | + - name: Checkout gh-pages |
| 71 | + uses: actions/checkout@v4 |
| 72 | + with: |
| 73 | + ref: gh-pages |
| 74 | + path: gh-pages |
| 75 | + - name: Copy the additional resources to gh-pages |
| 76 | + run: | |
| 77 | + rm -rf ./gh-pages/schema |
| 78 | + cp -R ./site/schema ./gh-pages/ |
| 79 | + rm -rf ./gh-pages/next/ |
| 80 | + cp -R ./packages/documentation/dist ./gh-pages/next/ |
| 81 | + cp ./scripts/resources/custom404.html ./gh-pages/404.html |
| 82 | + - name: Publish Docs |
| 83 | + run: | |
| 84 | + cd ./gh-pages |
| 85 | + git config --local user.email $GIT_COMMITTER_EMAIL |
| 86 | + git config --local user.name $GIT_COMMITTER_NAME |
| 87 | + git add . |
| 88 | + git commit -m "Updating supplemental resources for ${DOC_VERSION} documentation deployment" |
| 89 | + git push |
0 commit comments