🔧 Update vite configuration for bundling node dependencies #7
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: Publish Documentation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| jobs: | |
| build-and-publish-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up Git user && gh-pages directory | |
| env: | |
| SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_KEY }} | |
| run: | | |
| git config --global user.name "Theodore 🐈🤖" | |
| git config --global user.email "[email protected]" | |
| mkdir -p ~/.ssh | |
| echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| ssh-keyscan github.com >> ~/.ssh/known_hosts | |
| echo "GH_PAGES_DIR=${HOME}/dist" >> "$GITHUB_ENV" | |
| - name: Determine DOCS_VERSION | |
| id: vars | |
| run: echo "DOCS_VERSION=${{ (github.ref_type == 'tag' && github.ref_name) || 'develop' }}" >> "$GITHUB_OUTPUT" | |
| - name: Log DOCS_VERSION | |
| run: 'echo "Using DOCS_VERSION: ${{ steps.vars.outputs.DOCS_VERSION }}\nUsing GH_PAGES_DIR: ${GH_PAGES_DIR}"' | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.ref }} | |
| - name: Use Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 'lts/*' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install | |
| - name: Clone gh-pages branch | |
| run: | | |
| git clone --branch gh-pages --depth 1 "[email protected]:${{ github.repository }}.git" "$GH_PAGES_DIR" | |
| - name: Build and copy docs | |
| run: | | |
| OUTDIR="${GH_PAGES_DIR}/${{ steps.vars.outputs.DOCS_VERSION }}" yarn copy-and-build | |
| ./dev/collect-versions.sh "$GH_PAGES_DIR" | |
| - name: Update latest | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| run: | | |
| LATEST=$(jq -r '.[1]' "${GH_PAGES_DIR}/versions.json") | |
| echo "Updating latest to: $LATEST" | |
| yarn cpx "./${GH_PAGES_DIR}/${LATEST}" "./${GH_PAGES_DIR}/latest" | |
| - name: Commit and push to gh-pages | |
| run: | | |
| cd "$GH_PAGES_DIR" | |
| git add . -f | |
| LAST_COMMIT_MSG=$(git --git-dir=${{ github.workspace }}/.git log -1 --pretty=%B) | |
| git commit -m "$LAST_COMMIT_MSG" || echo "No changes to commit" | |
| git push origin gh-pages |