Skip to content

Merge pull request #91 from syntaxandsips/mr-dark-debug/update-blog-l… #119

Merge pull request #91 from syntaxandsips/mr-dark-debug/update-blog-l…

Merge pull request #91 from syntaxandsips/mr-dark-debug/update-blog-l… #119

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Create gh-pages branch if it doesn't exist
- name: Create gh-pages branch if needed
run: |
# Configure Git identity
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
# Store current branch name
CURRENT_BRANCH=$(git branch --show-current)
echo "Current branch: $CURRENT_BRANCH"
if ! git ls-remote --heads origin gh-pages | grep gh-pages; then
echo "Creating gh-pages branch"
git checkout --orphan gh-pages
git reset --hard
git commit --allow-empty -m "Initial gh-pages commit"
git push origin gh-pages
# Return to original branch (usually main)
echo "Returning to $CURRENT_BRANCH branch"
git checkout $CURRENT_BRANCH || git checkout main
echo "Created gh-pages branch successfully"
else
echo "gh-pages branch already exists"
fi
# Skip GitHub Pages API enablement - it's causing issues
- name: GitHub Pages Setup Notice
run: |
echo "::notice::GitHub Pages API enablement is skipped due to permission issues."
echo "::notice::Please enable GitHub Pages manually after the workflow completes:"
echo "1. Go to your repository on GitHub"
echo "2. Navigate to Settings > Pages"
echo "3. Under 'Source', select 'GitHub Actions' from the dropdown"
echo "4. Save the settings"
echo "::notice::This only needs to be done once."
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: 'npm'
# Use Setup Pages without enablement parameter
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Build with Next.js
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./out
# Deployment job
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