Update deploy.yml #11
This file contains 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: Deploy Docusaurus Website | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
jobs: | |
deploy: | |
name: Deploy to GitHub Pages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: 'npm' | |
cache-dependency-path: 'docusaurus/package-lock.json' | |
- name: Install dependencies | |
working-directory: docusaurus | |
run: npm ci | |
- name: Build site | |
working-directory: docusaurus | |
run: npm run build | |
- name: Deploy to GitHub Pages | |
if: github.ref == 'refs/heads/main' | |
working-directory: docusaurus | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
REPOSITORY_URL="https://${{ github.actor }}:${{ secrets.GH_PAB_TOKEN }}@github.com/${{ github.repository }}.git" | |
git remote set-url origin "$REPOSITORY_URL" | |
npm run deploy | |
env: | |
GIT_USER: ${{ github.actor }} | |
GITHUB_TOKEN: ${{ secrets.GH_PAB_TOKEN }} |