Skip to content

Commit

Permalink
Update jekyll-gh-pages.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
aayush60 authored Nov 25, 2024
1 parent c5cd24a commit 6d18e1d
Showing 1 changed file with 31 additions and 15 deletions.
46 changes: 31 additions & 15 deletions .github/workflows/jekyll-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll with GitHub Pages dependencies preinstalled

name: Deploy React App to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
branches: ["main"] # Replace "main" with your default branch if needed
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
Expand All @@ -28,15 +22,37 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1

- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
exit 0
else
echo "No yarn.lock found. Exiting."
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
source: ./
destination: ./_site
node-version: "20"
cache: ${{ steps.detect-package-manager.outputs.manager }}

- name: Install dependencies
run: yarn install

- name: Build React App
run: yarn build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path:
./build # Update this path if your output folder is different

# Deployment job
deploy:
Expand Down

0 comments on commit 6d18e1d

Please sign in to comment.