Skip to content

Commit

Permalink
Updated Deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
p-miano committed Oct 11, 2024
1 parent e171d64 commit 8058540
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18' # Update Node.js to the latest stable version
node-version: '18'

# Step 3: Install dependencies
- name: Install dependencies
Expand All @@ -32,9 +32,33 @@ jobs:
- name: Build the project
run: npm run build

# Step 6: Deploy the built files to GitHub Pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GITHUB_TOKEN }} # Use personal_token for deployment
publish_dir: ./build
# Step 6: Backup .github/workflows directory
- name: Backup Workflows Directory
run: |
mkdir -p backup
cp -r .github/workflows backup/
# Step 7: Checkout gh-pages branch
- name: Checkout gh-pages branch
run: |
git fetch
git checkout gh-pages
# Step 8: Copy build files to the gh-pages branch
- name: Copy Build Files
run: |
rsync -av --delete ./build/ ./ # Copy build files into root directory
# Step 9: Restore .github/workflows directory
- name: Restore Workflows Directory
run: |
cp -r backup/workflows .github/
# Step 10: Commit and Push changes to gh-pages branch
- name: Commit changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Update GitHub Pages with new build and restore workflows [skip ci]" || echo "No changes to commit"
git push origin gh-pages

0 comments on commit 8058540

Please sign in to comment.