Skip to content

Commit

Permalink
Update deploy.yml to clean gh-pages branch before deployment
Browse files Browse the repository at this point in the history
- Added step to clean gh-pages branch before deployment to ensure a fresh start.
- Updated actions to the latest versions: actions/checkout@v4 and actions/setup-node@v4.
- Used npm ci for faster and more reliable dependency installation.
- Configured deployment to publish build output to 'swdr5-docs' directory.
  • Loading branch information
xoorbes committed Sep 1, 2024
1 parent 0b41ed0 commit 11db4b4
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,42 @@ on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm install
run: npm ci

- name: Build Docusaurus site
run: npm run build

- name: Clean gh-pages branch
run: |
git fetch origin
git checkout gh-pages || git checkout --orphan gh-pages
git rm -rf .
git clean -fdx
git commit --allow-empty -m "Clean gh-pages branch"
git push origin gh-pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
publish_branch: gh-pages
destination_dir: swdr5-docs

0 comments on commit 11db4b4

Please sign in to comment.