fix thanks #32
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 to GitHub Pages | |
on: | |
# Trigger the workflow on push to the main branch | |
push: | |
branches: ["main"] | |
# Allows manual trigger from the Actions tab | |
workflow_dispatch: | |
# Gives write (commit push) and deployment rights Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
# 1) Installation with npm install (generates package-lock.json) | |
- name: Install dependencies | |
run: npm install | |
# 2) Commit lock file auto if modified | |
- name: Commit lockfile changes | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "GitHub Actions" | |
# Checks if any files have changed (especially package-lock.json) | |
if [ -n "$(git status --porcelain)" ]; then | |
git add package-lock.json | |
git commit -m "chore: update package-lock.json" | |
git push | |
fi | |
# 3) Site build | |
- name: Build the Docusaurus site | |
run: npm run build | |
# 4) Upload build artifact for deployment job | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./build | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |