fix: copy error #40
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: Docs to GitHub Pages | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
# --------------------------------------------------------- # | |
# 1. Pull extra docs from external repo | |
# --------------------------------------------------------- # | |
pull-docs: | |
if: github.actor != 'github-actions[bot]' | |
runs-on: ubuntu-latest | |
permissions: { contents: read } | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Make fetch_docs.sh executable | |
run: chmod +x ./src/scripts/fetch_docs.sh | |
- name: Fetch all docs | |
run: ./src/scripts/fetch_docs.sh | |
- name: Upload docs artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs-raw | |
path: ./docs/ | |
# --------------------------------------------------------- # | |
# 2. Commit those docs back into the repo (if changed) | |
# --------------------------------------------------------- # | |
commit-docs: | |
needs: pull-docs | |
if: github.actor != 'github-actions[bot]' | |
runs-on: ubuntu-latest | |
permissions: { contents: write } | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Download docs artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: docs-raw | |
path: ./docs/dev/ | |
- name: Commit & push if changed | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add docs/ | |
git commit -m "Update pulled docs" || echo "No changes" | |
# ---- Auth for push ---- | |
git remote set-url origin \ | |
https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
git push origin HEAD:main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# --------------------------------------------------------- # | |
# 3. Build site + Tina, publish to gh-pages | |
# --------------------------------------------------------- # | |
deploy: | |
needs: commit-docs | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read # checkout needs this | |
pages: write # let the action publish | |
id-token: write # ⭐ required by deploy-pages | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Download Built Docs Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: docs-raw | |
path: ${{ github.workspace }}/build | |
- name: Make build.sh executable | |
run: chmod +x build.sh | |
- name: Install Dependencies | |
run: npm install | |
- name: Build TinaCMS and Docusaurus Site | |
env: | |
TINA_PUBLIC_CLIENT_ID: ${{ secrets.TINA_PUBLIC_CLIENT_ID }} | |
TINA_TOKEN: ${{ secrets.TINA_TOKEN }} | |
DOCS_BASEURL: ${{ secrets.DOCS_BASEURL }} | |
run: npm run build | |
- name: Remove gitignore file | |
run: rm ./build/admin/.gitignore | |
# --- Upload static site as artifact --- | |
- name: Upload Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./build # folder that holds index.html | |
# --- Deploy to GitHub Pages (official) --- | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |